Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36823
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2017-07-07 12:00 -0700 |
| References | (1 earlier) <ojo339$fa$1@dont-email.me> <0175016c-5ab9-4867-a9d1-7c43907e4427@googlegroups.com> <ojo90v$l5f$1@dont-email.me> <c30448c3-8f2b-4eba-80c4-c395566dd970@googlegroups.com> <ojokuh$tqh$1@dont-email.me> |
| Message-ID | <ad49ff16-7feb-46d7-82df-d13b22d69a90@googlegroups.com> (permalink) |
| Subject | Re: Confusing interface |
| From | Eric Douglas <e.d.programmer@gmail.com> |
On Friday, July 7, 2017 at 2:50:49 PM UTC-4, Eric Sosman wrote: > Cloning a B gives whatever A's clone() implementation returns. > That might be a B, or an A, or a C, or an Object -- it's entirely > up to clone(). > > ... but what has any of this to do with overriding or failing > to override? Did you work through the example I gave? Did it > behave as you expected (and/or did your expectations adjust to > its behavior)? > That is the override, or lack of, and it sounds like you're saying what I suspect. DefaultMutableTreeNode implements Cloneable, so if I extend it I must implement Cloneable, or else create a clone() method that simply throws an exception. Otherwise someone could clone my class and get an instance of DefaultMutableTreeNode, when they should expect it to return an instance of the extending class.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 06:10 -0700
Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 09:45 -0400
Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 07:37 -0700
Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 11:26 -0400
Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 11:24 -0700
Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 14:50 -0400
Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 12:00 -0700
Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 15:27 -0400
Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 12:47 -0700
Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 16:25 -0400
Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 13:39 -0700
Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 17:43 -0400
csiph-web