Re: Copying an Object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23 September 2010 02:14, Daniel Kolbo <kolb0057@xxxxxxx> wrote:

*snip*

> 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.

Regards
Peter

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

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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux