Re: Copying an Object

From: Date: Thu, 23 Sep 2010 06:24:50 +0000
Subject: Re: Copying an Object
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-308263@lists.php.net to get a copy of this message
On 23 September 2010 02:14, Daniel Kolbo <kolb0057@umn.edu> 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>

« previous php.general (#308263) next »