Breaking

Followers

Monday, 30 March 2015

What is final class.

final class is a class that can not be inherited.Its protect the methods of class to be overriden by the child classes.
    final class baseclass
            {
                public function mymethod()  {
                          echo  "baseclass method";
                            }

            }

            class derivedclass extends baseclass
             {
                        public function mymethod() {
                                 echo   "derivedclass method";

                              }

               }

          $c= new derivedclass();
          $c->mymethod();

No comments:

Post a Comment