PHP OOP Inheritance
PHP OOP Inheritance
class countries {
public $ind="india";
public $usa="united states";
public $jp="japan";
public $pk="pakistan";
}
class players extends countries {
public $name1="sachin";
public $name1="james";
public $name1="chinchang";
public $name1="afridi";
public function getPlayer(){
return $this->name1."is from" $this->ind
}
}
$player= new players();
echo $player->getPlayer();
PHP OOP Inheritance
class countries {
public $ind="india";
public $usa="united states";
public $jp="japan";
public $pk="pakistan";
}
class players extends countries {
public $name1="sachin";
public $name1="james";
public $name1="chinchang";
public $name1="afridi";
public function getPlayer(){
return $this->name1."is from" $this->ind
}
}
$player= new players();
echo $player->getPlayer();