0
我有一個小問題。封裝問題
我有3類:
Class Animal {
public $dog;
function __construct() {
$this->dog = new Dog();
}
}
Class Dog {
public $scream;
function __construct() {
$this->scream = new Scream();
}
}
Class Scream {
public $scream;
function __construct() {
}
public haaa(){
return 'hello World';
}
}
我試圖讓haaa()
功能。與
$animal = new Animal();
$animal->haaa();
如果函數haaa()
是進入Dog
類..它工作正常..我們是否有深度封裝的限制?
謝謝!
是的..這是真的......糟糕的錯誤-_-「謝謝你! –