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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to