<?php
class Fruit
{
protected $mType = ' ';
protected $mColor = 'Green';
public function getType()
{
return $this->mType;
}
final public function getColor()
{
return $this->mColor;
}
}
final class Apple extends Fruit {
protected $mType = ' ';
protected $mColor = 'Red';
final public function getColor()
{
return "Apple:".$this->mColor;
}
}
$generalFruit = new Fruit();
$myApple = new Apple();
echo $generalFruit->getType().":".$generalFruit->getColor()
." ".$myApple->getType().":".$myApple->getColor();