Code:
<?phpecho "<center><h1>Inheritance in PHP</h1>";
class Person
{
public $name="Dominic Toretto";
}
class human extends Person
{
public function Greet()
{
return "My name is " . $this->name;
}
}
$person = new human();
echo $person->Greet();
echo "</center>";
?>
No comments:
Post a Comment