name = $name; } //抽象方法没有方法体{} abstract public function hello(); abstract public function say(); public function test() { return 'Demo::test()'; }}class Demo1 extends Demo{ //必须在子类中全部实现父类中的抽象方法 public function hello() { return 'hello '.$this->name; } public function say() { return '我的name:'.$this->name; }}$obj = new Demo1('php');echo $obj->hello();echo '
';echo $obj->say();