ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
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.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message