final keyword can be used to declare a class uninheritable : final « Class « PHP






final keyword can be used to declare a class uninheritable

 
<?
    final class Dog {
            private $Name;
            public function getName( ) {
                    return $this->Name;
            }
    }

    class Poodle extends Dog {
            public function bark( ) {
                    print "'Woof', says " . $this->getName( );
            }
    }
?>
  
  








Related examples in the same category

1.final class
2.Declaring Final Classes and Methods
3.Final Methods
4.The final keyword is used to declare that a method or class cannot be overridden by a subclass