问答详情
源自:2-8 PHP类和对象之对象继承

class Truck extends Car

定义继承于Car的Truck类 是这样写?

提问者:星梦00 2014-12-30 17:55

个回答

  • sxian_wang
    2014-12-31 13:50:37

    是这样写的

    class Truck extends Car{

        function speedUp(){

            $this->speed +=60;

            return $this->speed;

        }

    }