On 23 September 2010 02:14, Daniel Kolbo <kolb0...@umn.edu> wrote:


> On 9/22/2010 9:11 AM, chris h 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.

Perhaps if you're a C# programmer, but the PHP way of thinking is
radically different.
C#: This object is whatever it was currently cast to (if possible)
PHP: This object is this object, whatever it was created as

If you have a need to make an object switch class in PHP, then there's
a 99% chance you're working against, not with the language.

>  This type of thing would especially be
> easy if objects of parent classes could be cast as an object of its
> extended class.

I'll hazard a guess and say you didn't start programming in PHP but in
something else.


WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15

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

Reply via email to