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) { }
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.