My problem is illistrated by the following test code:

class test {

        var $flag = 0;
        function getFlag() { return $this->flag; }

        var $t;

        function Init() {
                $c = new test;
                $this->t = $c;
                $c->flag = 1000;
        }

        function EchoFunc() { echo("=" . $this->t->getFlag()); }

}

$test = new test;
$test->Init();
$test->EchoFunc();

When run, the number 0 is returned. Given copying symantecs, this is what
you would expect. $c is initilized with flag=0, the next line takes a copy
of $c and puts it in $t, the next line sets flag=1000 on $c, but not on $t.

However I would like refernce semantics and the final output of this script
to be 1000. So I changed the line to "$this->t &= $c;" and suddenly I get
the error: "Fatal error: Call to a member function on a non-object in
/user/sh/jmb/Project/Wiki/Public_html/test.php on line 25"

Anyone have any help on what is happening?

Thanks,
James.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to