Object Type Information : Objects « Class « PHP






Object Type Information

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

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

    $poppy = new Poodle;
    $poppy->Name = "Poppy";
    $poppy->bark( );
    if ($poppy instanceof poodle) { }
    if ($poppy instanceof dog) { }
?>
  
  








Related examples in the same category

1.Comparing Objects with == and ===
2.Create a new class and create an instance then use its property and method
3.Object Initialization
4.Object Overloading
5.Object Properties
6.Objects Within Objects
7.Creating a new object and assigning it to a variable