Hi,
I currently have two classes, one called Dog, one called Poodle. Now how can I use a variable defined in Dog from the Poodle class. My code is as follows:
class dog {
protected static $name = '';
function __construct($name) {
$this->name = $name
}
}
class Poodle extends dog {
function __construct($name) {
parent::__construct($name)
}
function getName(){
return parent::$name;
}
}
$poodle = new Poodle("Benjy");
print $poodle->getName();
I get this error
Notice: Undefined variable: name