Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7118
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx02.iad01.newshosting.com!newshosting.com!216.196.98.142.MISMATCH!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Sun, 14 Aug 2011 20:36:15 -0500 |
| Date | Sun, 14 Aug 2011 18:36:13 -0700 |
| From | Patricia Shanahan <pats@acm.org> |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: A question about a few variables in a class |
| References | <c5422014-46bd-4c77-9302-839b5cb587a2@a2g2000prf.googlegroups.com> |
| In-Reply-To | <c5422014-46bd-4c77-9302-839b5cb587a2@a2g2000prf.googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <77qdnZeE0p6N5dXTnZ2dnUVZ_hOdnZ2d@earthlink.com> (permalink) |
| Lines | 39 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 70.230.203.65 |
| X-Trace | sv3-kGmNiRaXTA+VR6z2HxhvsHhp2q2guvGVgI6PRTNjj1RqBBTJ1JfpsSMtTTeLmumZ9PS59SvhODpl3qm!qtFd9Iq+GRtHtkt9KMOsHSr969fe3tdDMVXTuu2ZLfQpa7rDQdxkFTaMc5EpHUrkJ4rPhoCLnSft!mhWzmI4LMwdirAZC8TVBJo4BkHE23KHBmJnWZmEL+0t3uw== |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2472 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7118 |
Show key headers only | View raw
On 8/5/2011 2:31 PM, Chad wrote:
> Let's say I have the following class.....
>
>
> public class ComparableRectangle extends Rectangle implements
> Comparable {
> public ComparableRectangle(double width, double height) {
> super(width, height);
> }
>
> public int compareTo(Object o) {
> if (getArea()> ((ComparableRectangle)o).getArea())
> return 1;
> else if (getArea()< ((ComparableRectangle)o).getArea())
> return -1;
> else
> return 0;
> }
> }
>
>
> Are 'width' and 'height' data fields in this class? My initial guess
> is yes. However, the fact that they are passed to super() makes me
> wonder otherwise.
If "Rectangle" above is the same as Rectangle1 in your recent message,
the answer is that width and height are not members of
ComparableRectangle, because private fields are not inherited by subclasses.
On the other hand, the getWidth, setWidth, getHeight, and setHeight
methods in Rectangle are inherited members of ComparableRectangle.
ComparableRectangle can operate on its width and height attributes
through those methods, it just can't see how the information is
implemented in Rectangle.
Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-05 14:31 -0700
Re: A question about a few variables in a class markspace <-@.> - 2011-08-05 14:46 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-06 07:56 -0400
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-13 10:30 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-13 20:49 -0400
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-14 13:23 -0700
Re: A question about a few variables in a class markspace <-@.> - 2011-08-14 13:52 -0700
Re: A question about a few variables in a class Lew <lewbloch@gmail.com> - 2011-08-14 22:50 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-14 18:04 -0400
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-14 17:09 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-14 21:57 -0400
Re: A question about a few variables in a class Lew <lewbloch@gmail.com> - 2011-08-14 22:55 -0700
Re: A question about a few variables in a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-14 18:01 -0400
Re: A question about a few variables in a class Roedy Green <see_website@mindprod.com.invalid> - 2011-08-06 22:58 -0700
Re: A question about a few variables in a class Patricia Shanahan <pats@acm.org> - 2011-08-07 05:28 -0700
Re: A question about a few variables in a class Lew <lewbloch@gmail.com> - 2011-08-10 09:14 -0700
Re: A question about a few variables in a class Chad <cdalten@gmail.com> - 2011-08-13 10:27 -0700
Re: A question about a few variables in a class Patricia Shanahan <pats@acm.org> - 2011-08-14 18:36 -0700
csiph-web