abstract class Goods{
public $name;
public $price;
public function __construct($name,$price)
{
$this->name = $name;
$this->price = $price;
}
abstract public function getName();
public function getPrice(){
return $this->price;
}
}
class book extends Goods{
public $author;
public $publisher;
public function __construct($author,$publisher,$name, $price){
parent::__construct($name, $price);
$this->author=$author;
$this->publisher=$publisher;
}
public function getName(){
return $this->name.$this->price;
}
}
class phone extends Goods{
public $brand;
public $color;
public function getName(){
return $this->name;
}
}