Reply to Re: [PHP] PHP 5 Question about OO

Your name:

Reply:


Posted by Marcus Bointon on 06/02/05 11:45

On 2 Jun 2005, at 03:00, Richard Lynch wrote:

> Maybe I'm being dumb, but how can an object's __autoload function get
> called when the object class definition hasn't been loaded, and
> that's why
> you're calling __autoload in the first place...

It wouldn't solve everything, but it would help. It solves the case
where you have a class library that's quite heavily interconnected,
and member functions instantiate other classes in that library (a
common arrangement in my experience). By having an __autoload method,
you get to at least partly avoid global handler clashes by having one
that is specific to that library (it would work well in PEAR). If it
is in a base class, then you are safe in the knowledge that any class
can find any other in the same library, without tripping over anyone
else's arrangements. You would still have to deal with the problem of
finding the first class (which a global handler may help, subject to
the issues that you've already raised), but once that's done, the
problem is over. I don't see why they named it __autoload - the __
prefix is usually reserved for special purpose methods, not global
functions. Just plain 'autoload' in a global context is not really
anything wildly different in style to say ini_set or error_reporting.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация