<?php |
class Fruit |
{ |
protected function showColor() { |
echo "Fruit::showColor()\n" ; |
} |
} |
class Apple extends Fruit |
{ |
// Override parent's definition |
public function showColor() |
{ |
// But still call the parent function |
parent::showColor(); |
echo "Apple::showColor()\n" ; |
} |
} |
$apple = new Apple(); |
$apple ->showColor(); |
?> |