ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl_schnaitter.consult...@peoplesoft.com
Subject Re: Implementing the Clonable interface in a task
Date Mon, 12 Aug 2002 17:54:15 GMT

James Lee Carpenter wrote:
>>>>>>>>>>>>>
I have been away from java for a year or so.  Can anyone remind me why the
clone method's return type is object instead of the type of object
being cloned?  Isn't it a bit sloppy to require casting the cloned object?
>>>>>>>>>>>>>

When a subclass overrides a function definition, it needs to match the
return type in the superclass, so when you override Object.clone(), (whose
return type is Object, of course) your return type must be an Object.

-Karl




--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message