Example #1
0
    public function run()
    {
        echo 'I run fast';
    }

    private function drive()
    {
        echo 'I drive a car';
    }
}

class Son extends Dad
{
    public function goToSchool()
    {
        echo 'I go to school';
    }

    public function whatIsMyName()
    {
        echo $this->name;
    }
}

$son = new Son('Nick', 'Long');
$son->run(); //will output I run fast
$son->goToSchool(); //will output I go to school
$son->drive(); //produces an error
$son->whatIsMyName(); //will ouput  Nick