Beispiel #1
0
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
class Car
{
    public function myName()
    {
        //self::getName;
        $this->getName();
    }
    public function getName()
    {
        echo "I am a car \n";
    }
}
class Bus extends Car
{
    public function getName()
    {
        echo "I am a Bus \n";
    }
}
$crick = new Bus();
$crick->myName();
echo '<br>';
$abcd = new Car();
$abcd->myName();
echo '<br>';
$bcd = new Bus();
$bcd->getName();