note 46897 added to language.references.pass
| From: | YevgenyYegorov at osu1 dot php dot net | Date: | Wed, 27 Oct 2004 12:34:31 +0000 |
| Subject: | note 46897 added to language.references.pass | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79168@lists.php.net to get a copy of this message | ||
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...
----
Manual Page -- http://www.php.net/manual/en/language.references.pass.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46897
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46897&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46897&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46897&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46897&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46897&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46897&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46897&report=yes
Search -- http://master.php.net/manage/user-notes.php