class DogTag {
public $Words;
}
class Dog {
public $Name;
public $DogTag;
public function bark( ) {
print "Woof!\n";
}
public function _ _construct($DogName) {
print "Dog: $DogName\n";
$this->Name = $DogName;
$this->DogTag = new DogTag;
$this->DogTag->Words = "$DogName:555-1234";
}
}
class Poodle extends Dog {
public function bark( ) {
print "Yip!\n";
}
}
$poppy = new Poodle("Poppy");
print $poppy->DogTag->Words . "\n";
function namechange($dog) {
$dog->Name = 'Dozer';
}
namechange($poppy);
print $poppy->Name . "\n";
namechange(clone $poppy);
?>