写法一:
class Text1{
private _path;
//实施例有默认值
public function __construct{
$this->_path='./'
}
//使用属性_path
public function usePath(){
return $this->_path;
}
}
写法二:
class Text2{
private _path='./';
//使用属性_path
public function usePath(){
return $this->_path;
}
}
两个类调用usePath();结果一样吗?有什么区别?
KevenHuang