hi all.
i have a class that handles with several sub classes.
i wanted to pass a reference to the main class to a function of a subclass, so the main class can be used and altered within the subclass.
i tried it with an ampersand "&" in from of the parameters, but i remarked that it just does not have any influence on the result!
01 | class mainClass {
02 | function x() {
03 | $sub = new subClass();
04 |
05 | // call the subclass' function
06 | $sub->someFunc(&$this);
07 | }
08 | }
09 |
10 | class subClass {
11 | function someFunc(&$main) {
12 | // ... do some stuff ...
13 | }
14 | }
i tried several possibilities:
$sub->someFunc(&$this);
function someFunc(&$main)
$sub->someFunc($this);
function someFunc(&$main)
$sub->someFunc(&$this);
function someFunc($main)
$sub->someFunc($this);
function someFunc($main)
but how said, it did not have any influence on the result.
my question: is there always just passed a reference and not the whole "$this" object?
thank you very much for info.
Josh