note 21600 rejected from ref.classobj by torben
| From: | torben@php.net | Date: | Mon, 20 May 2002 22:03:13 +0000 |
| Subject: | note 21600 rejected from ref.classobj by torben | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30815@lists.php.net to get a copy of this message | ||
A problem concerning nested objects:
Now this may be obvious to some (if so please let me know!) but I have the two following statements:
// 1.
echo $ProfileRoom->queryobjects["ImageNames"]->GetNumRows();
// 2.
echo $ProfileRoom->GetQueryObj("ImageNames")->GetNumRows();
In each I tried a different way to access a member function (GetNumRows()) of a object that resides
within an associative array (queryobjects[]) which is itself a member variable of a parent object
($ProfileRoom).
As I expected, PHP doesn't like 2. (it chucked out a parse error), whereas 1. works fine.
My issue with this is that I'm tying to be true to OO principles and only access members via
get/set functions, as such, even though statement 1. works, I don't like it...
Can anyone show me a better way???
Thanks very much,
Justin