note 46897 deleted from language.references.pass by betz
| From: | betz@php.net | Date: | Wed, 27 Oct 2004 13:42:12 +0000 |
| Subject: | note 46897 deleted from language.references.pass by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79173@lists.php.net to get a copy of this message | ||
Note Submitter: Yevgeny Yegorov
----
I had such code:
class A
{
var $test1;
function A($_test1)
{
$this->test1 = $_test1;
}
}
class B
{
var $obj;
function B($_param)
{
$this->obj = $_param;
}
}
$a = new A(5);
$b = new B($a);
"B" object has to use "A" object inside. Of course, I wanted "B"
object to have up-to-date "A" object at every moment.
I tried to do so:
class B
{
var $obj;
function B(& $_param)
{
$this->obj = $_param;
}
}
As explained in manual, I placed "&" before function argument declaration. It did not
work :-(
But the following worked correct:
class B
{
var $obj;
function B(& $_param)
{
$this->obj = & $_param;
}
}
Though, I don't know why it is so...
----
Reason: useless note