Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.help Subject: Re: Enum basics Date: Sat, 5 Nov 2011 00:51:50 -0700 (PDT) Organization: http://groups.google.com Lines: 67 Message-ID: <11919463.149.1320479510450.JavaMail.geo-discussion-forums@prgt10> References: <3bo8b7dd306f6pj50v2jk3t9704n1c0cjp@4ax.com> <21054701.30.1320463633638.JavaMail.geo-discussion-forums@prog16> Reply-To: comp.lang.java.help@googlegroups.com NNTP-Posting-Host: 173.164.137.213 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1320479595 24698 127.0.0.1 (5 Nov 2011 07:53:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 5 Nov 2011 07:53:15 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.213; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:1286 John B. Matthews wrote: > Lew wrote: ... >> Boom. Second question answered. No, an enum cannot access an=20 >> enclosing class's instance members. What's the big mystery? >=20 > D'oh, I misread the question, thinking of _static_ members of the=20 > enclosing class; Roedy clearly said _instance_. Yeah, I had to reread the post a couple of times to make sure I had the sen= se of it right way 'round. As for my post upthread, the "you" there was the generalized "you, the read= er", not you the poster. I was writing a post, not an email, so what I sai= d was not meant for anyone to take personally but in the spirit of an essay= . Just in case, you know. As for the distinction between "nested" (i.e., static) and "inner" (instanc= e) classes, I have been much more sensitive to the fine distinction after e= ncountering the interesting edge case of an inner class that inherits from = its containing class and accesses the latter's private members. package eegee; public class Outer { private String foo() { return "Outer.foo() "; } protected String bar() { return "Outer.bar() "; } class Inner extends Outer { public String foo() { return "Inner.foo() "; } public String bar() { return "Inner.bar() "; } } public static void main(String [] args) { Outer encloser =3D new Outer(); Inner inner =3D encloser.new Inner(); Outer outer =3D inner; System.out.println("encloser: " + encloser.foo() + encloser.bar()); System.out.println(" outer: " + outer.foo() + outer.bar()); System.out.println(" inner: " + inner.foo() + inner.bar()); } } Of course, @Override helps here. --=20 Lew