首页 > 代码库 > 面向对象(游戏)

面向对象(游戏)

<?php

abstract class Game {
protected $name;//名称
protected $dengji;//等级
}
//盗贼子类
class DaoZei{
protected $name;
protected $dengji;
public function __constuct($name){
$this->name = $name;
}
}
//农民子类
class NongMing{
protected $name;
protected $dengji;
public function __constuct($name){
$this->name = $name;
}
}
//士兵子类
class ShiBing{
protected $name;
protected $dengji;
public function __constuct($name){
$this->name = $name;
}
}
//医生子类
class YiSheng{
protected $name;
protected $dengji;
public function __constuct($name){
$this->name = $name;
}
}
//创建偷盗接口
interface Toudao {

}

//创建采矿接口
interface Caikuang {

}

//创建打猎接口
interface Dalie {

}

//创建抵抗接口
interface Dikang {

}

//创建攻击接口
interface Gongji {

}

//创建治疗接口
interface Zhiliao {

}

?>

面向对象(游戏)