Commit c9f8d284 authored by danmcquillan's avatar danmcquillan
Browse files

ca & dog classes for autoload

parent 69b773a1
<?
/* Cat class extends Pet.
* Cat overrides play().
*/
class Cat extends Pet {
function play() {
// Call the Pet::play() method:
parent::play();
echo "<p>$this->name is climbing.</p>";
}
} // End of Cat class.
?>
<?
/* Dog class extends Pet.
* Dog overrides play().
*/
class Dog extends Pet {
function play() {
// Call the Pet::play() method:
parent::play();
echo "<p>$this->name is fetching.</p>";
}
} // End of Dog class.
?>
<?
class Pet {
public $name;
function __construct($pet_name) {
$this->name = $pet_name;
self::sleep();
}
function eat() {
echo "<p>$this->name is eating.</p>";
}
function sleep() {
echo "<p>$this->name is sleeping.</p>";
}
function play() {
echo "<p>$this->name is playing.</p>";
}
} // End of Pet class.
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment