aladdinx
2017-10-07 16:42
class E { public $age = 0; public $username = ""; public $obj = null; public function __clone() { // TODO: Implement __clone() method. $this->obj = clone $this->obj; } } class F { public $sex = 0; } $e = new E(); $e->obj = new F(); $f = clone $e; $f->obj->sex = 8; var_dump($f->obj->sex);//int(8),为什么还是8,应该为0啊
var_dump($e->obj->sex);为0,谢谢采纳
PHP-面向对象
29004 学习 · 38 问题
相似问题