You are here: Re: Using a Resource as a Class Property « PHP Programming Language « IT news, forums, messages
Re: Using a Resource as a Class Property

Posted by Sanders Kaufman on 07/22/07 01:33

Michael Fesser wrote:
> .oO(Sanders Kaufman)
>
>> So I'm doing it right?! Cool.
>
> It always depends on what you want to achieve. From just looking at the
> posted snippet and without knowing what the my_baseclass is supposed to
> do, it's hard to tell whether you're doing it right or not, since the
> code is not doing anything useful, except for initializing some member
> variables.
>
>> I know there are some cases where you're
>> supposed to serialize objects instead of... what am I doing, passing by
>> reference? Instantiating?
>
> Aggregating. ;) You create an instance of a class, which is used inside
> another object. That's it (in this case).
>
> Serializing can be used if you want to store an object to a file or a
> database.
>
> Micha

OK - that was weird, and took some debugging.
I knew there was *something* about scope to deal with here.

I'm aggragating the database object into a base class, and then creating
other classes that "extend" that base class.

HOWEVER, in order to do that, I had to move the instantiation(?) of the
database class into the extended class. When I had it in the base
class, the class that extended it could not see the database properties
and functions.

Whew.

 

Navigation:

[Reply to this 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

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