<?php
class dog {
// declare two private variables
private $Name;
private $DogTag; public function bark() {
print "Woof!\n";
} public function printName() {
print $this->Name; // prints nothing!
}
} // new class, for testing derived stuff
class poodle extends dog {
public function bark() {
print "Yip!\n";
}
}// I now create an instance of the // derived class $poppy = new poodle;
// and set its private property $poppy->Name = "Poppy"; print $poppy->Name. "\n"; $poppy->printName(); print_r($poppy); ?>
outputs:
Poppy
poodle Object
(
[Name:private] =>
[DogTag:private] =>
[Name] => Poppy
)Is this expected behavior or should I open a bug?
Greg
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
