<?php
abstract class Demo{
public $name;
public function __construct($name){
$this->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 '<hr>';
echo $obj->say();
echo '<hr>';
echo $obj->test();
?>