class Person {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
public function Profession($p) {
echo self::getName(). " - " . $p . "<br/>";
}
}
class Genius extends Person {
public function __construct($name) {
parent::__construct($name);
}
}
$obj = new Genius("Albert Einstein");
echo $obj->getName() . "<br />";
$obj->Profession("Theoretical Physicist");
/*
run:
Albert Einstein
Albert Einstein - Theoretical Physicist
*/