📅  最后修改于: 2020-10-09 01:32:27             🧑  作者: Mango
抽象类是接口和类之间的混合体。它可以定义功能以及接口。
abstract class MyAbstract
{
//Methods
}
//And is attached to a class using the extends keyword.
class Myclass extends MyAbstract
{
//class methods
}
dis1();
$obj->dis2();
?>
输出:
name . ", " . $this->age . " years old";
}
abstract public function Greet();
}
class Dog extends Animal
{
public function Greet()
{
return "Woof!";
}
public function Describe()
{
return parent::Describe() . ", and I'm a dog!";
}
}
$animal = new Dog();
$animal->name = "Bob";
$animal->age = 7;
echo $animal->Describe();
echo $animal->Greet();
?>
输出: