Using The Parent Construct

<?php
class Cat {
    var $age;    function Cat($new_age){
        $this->age = $new_age;
    }
    function Birthday(  ){
        $this->age++;
    }
    function Eat(  ){        echo "Chomp chomp.";
    }
    function Meow(  ){        echo "Meow.";
    }
}class MyCat extends Cat {
    function MyCat(  ) {
    }
    function eat(  ) {
        parent::eat(  );
        $this->meow(  );
    }
}
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.