Correcting teacher:查无此人
Correction status:qualified
Teacher's comments:完成的不错,继续加油。
<?php
abstract class a{
public $name;
public function __construct($name){
$this -> name = $name;
}
public function af(){
echo $this -> name;
}
abstract public function aff();
}
class b extends a{
public function aff(){
echo $this -> name;
}
}
$a = new b('欧阳');
$a -> af();
echo '<br>';
$a = aff();
<?php
abstract class P{
protected $name;
protected function __construct($name='peter'){
$this->name;
}
public function getName(){
return $this->name;
}
abstract protected function setName($value);
}
class stu extends P{
public function __construct($name = 'peter'){
parent::__construct($name);
}
public function setName($value){
$this->value;
}
}
$stu = new stu('猪');
echo '真的很贵哦:' . $stu->getName() . '<hr>';
$stu->setName('灭绝师太');
echo '讲师' . $stu->getName();