D_C wrote:
 > $this->parent = mysql_fetch_object($res); // returns a mysql obj with
age, loc etc records

then ...

$age = $userObj->age;   // this actually comes straight from the dbase obj
$rating = $userObj->rating;   // a public var calculated at construction
$life = $userObj->getSpend();  // this is a method to do a calc.

I could use a component (is the right OOP pattern word?)
$age = $userObj->dbObj->age

I believe the correct term for this is an object.


but I wanted to hide where the items are coming from. Also i want to be able to just keep adding to the database without having to create gettter/settter functions for everything...

I think python had some nice means of doing get/set functions
transparently, does PHP5 have anything like this?

PHP5 does have get and set functions ( http://www.php.net/manual/en/language.oop5.overloading.php ) however, your problem might be extrapolating all the properties of the object, because if you change your database structure, then you wil have new properties in $dbObj.


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



Reply via email to