<?php
Header (' Content-type:text/html;charset=utf-8 ');
Face action{
Public function level ();
Public function stealing ();
Public function hunting ();
Public function mining ();
Public function treatment ();
Public function attack ();
Public function resistance ();
}
Class Thieves implements action{
protected $name;
Public function __construct ($name = ' rogue ') {
$this->name = $name;
}
Public Function level () {
Echo ' current level 3 ';
}
Public function stealing () {
Echo ' I can steal ';
}
Public Function Hunting () {
Echo ' Can't hunt ';
}
Public Function Mining () {
Echo ' cannot mining ';
}
Public Function treatment () {
Echo ' cannot be treated ';
}
Public Function Attack () {
Echo ' can attack ';
}
Public Function resistance () {
Echo ' can resist ';
}
Public Function instruction () {
Echo ' I am '. $this->name;
Echo ', ';
$this->level ();
Echo ', ';
$this->stealing ();
Echo ', ';
$this->hunting ();
Echo ', ';
$this->mining ();
Echo ', ';
$this->treatment ();
Echo ', ';
$this->attack ();
Echo ', ';
$this->resistance ();
}
}
Class Hunter extends thieves{
Public Function level () {
Echo ' current level 4 ';
}
Public function stealing () {
Echo ' I can't steal ';
}
Public Function Hunting () {
Echo ' but can hunt ';
}
Public Function Mining () {
Echo ' cannot mining ';
}
Public Function treatment () {
Echo ' cannot be treated ';
}
Public Function Attack () {
Echo ' but can attack ';
}
Public Function resistance () {
Echo ' can resist ';
}
Public Function instruction () {
Parent::instruction ();
}
}
Class Boor extends thieves{
Public Function level () {
Echo ' current level 2 ';
}
Public function stealing () {
Echo ' I can't steal ';
}
Public Function Hunting () {
Echo ' Can not hunt ';
}
Public Function Mining () {
Echo ' can mining ';
}
Public Function treatment () {
Echo ' can be treated ';
}
Public Function Attack () {
Echo ' can attack ';
}
Public Function resistance () {
Echo ' can resist ';
}
Public Function instruction () {
Parent::instruction ();
}
}
Class Docter extends thieves{
Public Function level () {
Echo ' current level 5 ';
}
Public function stealing () {
Echo ' I can't steal ';
}
Public Function Hunting () {
Echo ' Can not hunt ';
}
Public Function Mining () {
Echo ' cannot be mined ';
}
Public Function treatment () {
Echo ' can only be treated ';
}
Public Function Attack () {
Echo ' can not attack ';
}
Public Function resistance () {
Echo ' can not resist ';
}
Public Function instruction () {
Parent::instruction ();
}
}
Class Ranker extends thieves{
Public Function level () {
Echo ' current level 10 ';
}
Public function stealing () {
Echo ' I can't steal as a soldier ';
}
Public Function Hunting () {
Echo ' Can not hunt ';
}
Public Function Mining () {
Echo ' cannot be mined ';
}
Public Function treatment () {
Echo ' As a soldier I am not a doctor can not cure ';
}
Public Function Attack () {
Echo ' Can attack as a soldier ';
}
Public Function resistance () {
Echo ' can resist ';
}
Public Function instruction () {
Parent::instruction ();
}
}
$dz = new Thieves (' rogue ');
$dz->instruction ();
Echo ' <br> ';
Echo ' <br> ';
$LR = new Hunter (' Hunter ');
$LR->instruction ();
Echo ' <br> ';
Echo ' <br> ';
$NM = new Boor (' Farmers ');
$NM->instruction ();
Echo ' <br> ';
Echo ' <br> ';
$ys = new Docter (' Doctor ');
$ys->instruction ();
Echo ' <br> ';
Echo ' <br> ';
$bs = new Ranker (' Soldier ');
$bs->instruction ();
PHP Inheritance 2