<?php
class parents{
public $color , $lastName;
protected $DNA;
public function __construct($color , $lastName, $DNA){
$this->color = $color;
$this->lastName = $lastName;
$this->DNA = $DNA;
}
public function showParent(){
echo "Color : $this->color , Last Name : $this->lastName , DNA : $this->DNA";
}
}
class child extends parents{
public $name;
private $SSN;
public function __construct($color , $lastName , $DNA , $name , $SSN){
$this->color = $color;
$this->lastName = $lastName;
$this->DNA = $DNA;
$this->name = $name;
$this->SSN = $SSN;
}
public function showChild(){
echo "Color : $this->color , Last Name : $this->lastName , DNA : $this->DNA , Name : $this->name , SSN : $this->SSN";
}
}
$newObj = new Child("brown" , "Gour" , "--@-@@---@" , "Sudhir" , 1121121);
$newObj->showChild();
?>
To embed this program on your website, copy the following code and paste it into your website's HTML: