这个概念叫什么?

时间:2012-03-03 14:34:46

标签: php oop

编程中称这个概念是什么?特别是构造函数中的位。我想给谷歌一个术语。

<?PHP
class Foo{
    private $bar;

    function __construct(){
        **$a = new Foo();
        $a->setBar("Do I ever get printed?");
        $this = $a;**
    }

    function setBar($a){ 
        $this->bar = $a; 
    } 

    function getBar(){
        return $this->bar
    }
}
?>

<?PHP

$z = new Foo();
echo $z->getBar();

?>

1 个答案:

答案 0 :(得分:6)

“无限递归”。