【php开源代码栏目提醒】:网学会员php开源代码为您提供code3.17.php参考,解决您在code3.17.php学习中工作中的难题,参考学习。
<?php
class Car
{
private $carType;
private $number;
private $weight;
function __construct($number)
{
$this->GetCarType();
$this->GetWeight();
$this->GetNumber($number);
}
function GetNumber($number)
{
$this->number = $number;
echo "该车的车牌号是:".$this->number."<br/>";
}
function GetWeight()
{
$this->weight = "10吨";
echo "该车的重量是:".$this->weight."<br/>";
}
function GetCarType()
{
$this->carType ="奥迪A8";
echo "该车型号是:".$this->carType."<br/>";
}
}
$c = new Car("京A GH658");
?>