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