__construct()
class Order{
private $extend = '';
private $order = '';
public function init(){
parent::init();
$this->order = new Order();
$this->extend = new OrderEx();
}
public function listAction(){
$this->order->public();
}
public function makeAction(){
$this->extend->public();
}
}
与以下写法有什么不同吗?
class Order{
private $extend = '';
private $order = '';
public function init(){
parent::init();
}
public function listAction(){
$order = new Order();
$order->public();
}
public function makeAction(){
$extend= new extend();
$extend->public();
}
}
在下小菜鸟一枚,希望有个良好的编程习惯,有些基础不踏实 还望指点