这个概念在编程中被称为什么?特别是构造函数中的位.我想给谷歌一个术语.
<?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();
?>
Run Code Online (Sandbox Code Playgroud)