There is supposed to be a way you can avoid the cast from clone.
What is the feature called and how do you use it.
There is apparently more to it that just saying
public Footprint clone()
instead of
public Object clone()

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
>What is the feature called and how do you use it.
>There is apparently more to it that just saying
> public Footprint clone()
>instead of
>public Object clone()
»Note that this definition supports covariant returns -
that is, the specialization of the return type to a
subtype (but only for reference types).«
Java Language Specification, Third Edition,
8.4.5 Method Return Type
In a previous article, Roedy Green <my_email_is_posted_on_my_website@munged.invalid> said:
> public Footprint clone()
Maybe it's because I come from a C++ background, but I've always preferred
to make a copy constructor rather that rely on clone(). So I would write
Footprint myClone = new Footprint(myOldFootprint);
rather than
Footprint myClone = (Footprint)myOldFootprint.clone();

Signature
Paul Tomblin <ptomblin@xcski.com> http://xcski.com/blogs/pt/
"If Bill Gates had a dime for every time a Windows box crashed...
.... Oh, wait a minute, he already does."
Paul Tomblin - 05 Feb 2006 14:08 GMT
In a previous article, ptomblin+netnews@xcski.com (Paul Tomblin) said:
>In a previous article, Roedy Green
><my_email_is_posted_on_my_website@munged.invalid> said:
[quoted text clipped - 5 lines]
>rather than
> Footprint myClone = (Footprint)myOldFootprint.clone();
I should mention that I'm aware of the usefulness of the clone situation
where the item you're cloning might be one of several subclasses of the
"Footprint" and you want the new one to be the right one.

Signature
Paul Tomblin <ptomblin@xcski.com> http://xcski.com/blogs/pt/
Usenet should require licenses; licenses that can be revoked.
-- Abigail