> 
> > And the error is strange because you're doing
> > something strange!
> 
> I don't think I'm doing anything strange. What I 
> have exposed here is a simplification of my own 
> class loader. I have the main class that must 
> load (include and then instance) other PHP classes.
> The problem is that if I do instance other classes 
> in the loader > constructor they get a "copy" of the
> loader instance and not the real 
> instance reference.

That code (looked closely) confirms you're doing
something strange :)

A constructor cannot call (or rather should not call)
"itself" while being constructed. It leads to
"unexpected" results.

So technically in some cases you might be able to get
it, but on most occassions you won't, it depends on
how your class is made. And yours recurses, I'm
presuming you wanted that for some reason (??)

On almost all times your data will be still pointing
to your base class (second_class).

So i'm afraid your method is not reliable, dangerous
none the less.

The reliable and correct way of doing it is after your
constructor has finished your class and made it ready
(guaranteed), then you can do what you want to.

=====
Mukul Sabharwal ([EMAIL PROTECTED])

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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

Reply via email to