Пример #1
0
    {
        $this->live = $live;
    }
    abstract function isLive();
}
class Human extends Creature
{
    protected $gender;
    protected $age;
    function __construct($gender, $age)
    {
        parent::__construct(true);
        $this->gender = $gender;
        $this->age = $age;
    }
    public function isLive()
    {
        return $this->live;
    }
    public function getGender()
    {
        return $this->gender;
    }
    public function getAge()
    {
        return $this->age;
    }
}
$human = new Human('femail', 25);
echo $human->isLive();
Пример #2
0
<?php

echo "Hello, World";
$me = new Human(strtotime('1991-12-15'));
$me->sayName();
// "maasa yoshida"
while ($me->isLive()) {
    $me->work();
    if ($me->isSleepy()) {
        sleep(60 * 60 * 6);
    }
}