class Ball{
const SHAPE = "circular";
public $area = null;
}
class Football extends Ball{
const PI = 3.14;
public $radius;
public function __construct($radius){
$this->radius = $radius;
}
public function doIt(){
$this->area = PI*pow($this->radius,2);
return "the shape of the ball is:".self::SHAPE."the area is:".$this->area;
}
}
$fb = new Football(2.15);
echo $fb.doIt();
详细代码如上,代码编写没有问题,但是就是执行不了,提示Call to undefined function doIt(),不知道怎么回事。
拉风的咖菲猫
慕桂英546537
守着星空守着你