批改状态:合格
老师批语:
<?php
namespace vehicle\Civic;
class Civic
{
public $name = 'Civic';
private $power = '177';
public function __construct($name, $power)
{
$this->name = $name;
$this->power = $power;
}
public function race($time='7')
{
echo '加速时间' . $time . 's';
}
}点击 "运行实例" 按钮查看在线实例
<?php
namespace vehicle\Fit;
require('Civic.php');
use vehicle\Civic\Civic as Civic;
class Fit extends Civic
{
public $name = 'Fit';
private $power = '131';
public function __construct($name, $power)
{
$this->name = $name;
$this->power = $power;
$this->race('9');
}
}
$newFit = new Fit('new Fit', '131');
echo '<hr/>';
echo $newFit->race('9');点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号