W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
name = $name; $this->color = $color; } public function intro() { echo "水果是 {$this->name},颜色是 {$this->color}。"; } } // Strawberry 继承自 Fruit class Strawberry extends Fruit { public function message() { echo "我是水果还是浆果? "; } } $strawberry = new Strawberry("草莓", "红色"); $strawberry->message(); $strawberry->intro(); ?>