Re: Casting from parent class to child

From: Date: Fri, 08 Oct 2010 17:42:08 +0000
Subject: Re: Casting from parent class to child
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-308583@lists.php.net to get a copy of this message
On Fri, Oct 8, 2010 at 12:50 PM, Nathan Rixham <nrixham@gmail.com> wrote: > David Harkness wrote: >> >> Casting does not change an object. You must copy the relevant value(s) >> from >> the object returned into a new DateTimePlus. Since DateTime's constructor >> takes only a string, and I assume it won't accept your format directly, > > unless you implement __toString I believe (not tested) > IMO, that would be a truly useful feature to add if you were extending DateTime anyway. Andrew

« previous php.general (#308583) next »