class Car{
//在这里定义一个共有属性name
protected $name = '汽车';
public function getname(){
echo $this->name;
}
}
$car = new Car();
//在这里输出$car对象的name属性
$car->getname();
//在这里定义一个共有属性name
protected $name = '汽车';
public function getname(){
echo $this->name;
}
}
$car = new Car();
//在这里输出$car对象的name属性
$car->getname();
2015-02-22
class Car {
public $name;
public function getname(){
echo $this->name;
}
}
$car = new Car();
$car->name = 'lingdaixi';
$car->getname();
public $name;
public function getname(){
echo $this->name;
}
}
$car = new Car();
$car->name = 'lingdaixi';
$car->getname();
2015-02-22