<?
class foo
{
public function printItem($string)
{
echo 'Foo: ' . $string . PHP_EOL;
}
public function printPHP()
{
echo 'PHP is great.' . PHP_EOL;
}
}
class bar extends foo
{
public function printItem($string)
{
echo parent::printItem('lulz');
echo 'Bar: ' . $string . PHP_EOL;
}
}
$bar = new bar();
$bar->printItem('baz');
Комментариев нет:
Отправить комментарий