账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    Call to undefined function doIt()
    11
    0
    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(),不知道怎么回事。

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 月牙笑眼 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部