$level = rand(1, 3);
class board
{
public $power = 1;
protected $top = 'admin';
public function process($level)
{
if ($level <= $this->power) {
echo "删帖";
} else {
$top = new $this->top;
$top->process($level);
}
}
}
class admin
{
public $power = 2;
protected $top = 'police';
public function process($level)
{
if ($level <= $this->power) {
echo "封号";
} else {
$top = new $this->top;
$top->process($level);
}
}
}
class police
{
public $power = 2;
protected $top = null;
public function process($level)
{
echo "抓起来";
}
}
$judge = new board();
$judge->process($level);