Reply to Re: Using a Resource as a Class Property

Your name:

Reply:


Posted by Sanders Kaufman on 07/21/07 17:00

Michael Fesser wrote:
> .oO(Sanders Kaufman)
>
>> I'm wondering if I'm doing this right, as far as using another class
>> object as a PHP class property.
>>
>> class my_baseclass {
>> var $Database;
>> var $ErrorMessage;
>> var $TableName;
>> var $RecordSet;
>> function my_baseclass(){
>> $this->TableName = "";
>> $this->RecordSet = array();
>> $this->Database = new my_database();
>> $this->ErrorMessage = $this->Database->ErrorMessage;
>> return true;
>> }
>> }
>>
>> It seems to be working, but this kinds stuff skirts the edge of my PHP
>> grok, so I dunno.
>
> Using one object "inside" another is called an aggregation and a very
> common and important concept in OOP.

So I'm doing it right?! Cool. I know there are some cases where you're
supposed to serialize objects instead of... what am I doing, passing by
reference? Instantiating?


> But if you want to dive into that, I would strongly recommend to upgrade
> to PHP 5 and make use of its OOP features.

I soooooo want to do this in 5... but that won't be an option until like
October. Until then, it's gotta work on 4.

[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

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