<?php
abstract class Animal
{
protected $name;
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
abstract public function sound();
}
class Cat extends Animal
{
public function __construct($name)
{
$this->name = $name;
}
public function sound()
{
echo $this->name . ' sound meow';
}
}
$cat = new Cat('Cat 1');
$cat->sound();
?>
Output
Cat 1 sound meow