On Fri, Sep 24, 2010 at 4:09 AM, Gary <php-general@xxxxxxxxxxxxxxx> wrote: > Daniel Kolbo wrote: > >> Say you have two classes: human and male. Further, say male extends >> human. Let's say you have a human object. Then later you want to make >> that human object a male object. This seems to be a pretty reasonable >> thing to request of our objects. > > I don't think any human can change gender without major surgery, but I > don't know if you just chose your example badly or whether you really > think objects should be able to mutate into other types of object > without some kind of special treatment. But it would work in something like makehuman, where you start with a neuter form and scale one way or the other for physical features. If I remember correctly, we're' all xx until you become xy(genetically speaking). > >> This type of thing would especially be >> easy if objects of parent classes could be cast as an object of its >> extended class. > > Where would the extra data come from to fill in any fields the base > class does not have? Just think of a simple example with a Shape class, > extended by a ColouredShape class which contains some data about the > object's colour - if you have a Shape object it can't become a > ColouredShape without some surgery because bits of the ColouredShape's > anatomy are not present. > > -- > Gary Please do NOT send me 'courtesy' replies off-list. > PHP 5.2.12 (cli) (built: Jan 14 2010 14:54:11) > 1.7.7(0.230/5/3) 2010-08-31 09:58 Cygwin > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php