[thelist] basic OO php question

Rick den Haan rick.denhaan at gmail.com
Wed Apr 18 05:56:30 CDT 2007


kasimir-k wrote:
> Rick den Haan scribeva in 18/04/2007 8:31:
> > I could potentially pass $this along, but I
> > doubt if that's a very recommendable practice.
> 
> It would be exactly what I'd recommend.
> 
> In X you'd have:
> $y = new Y($this);
> 
> and in Y:
> function Y(&$ref) {
>     echo $ref->foo;
> }
> 
> Note that you are passing a reference, not a copy.
> 
> .k

Thanks! I use references quite often, I don't know why I didn't think of
that in the first place...

Rick.




More information about the thelist mailing list