digitalmars.D - nested classes
- "Kris" <someidiot earthlink.dot.dot.dot.net> Jun 03 2004
- Arcane Jill <Arcane_member pathlink.com> Jun 03 2004
- "Kris" <someidiot earthlink.dot.dot.dot.net> Jun 03 2004
- "Blandger" <zeroman prominvest.com.ua> Jun 04 2004
- "Kris" <someidiot earthlink.dot.dot.dot.net> Jun 04 2004
- "Phill" <phill pacific.net.au> Jun 05 2004
Thought I'd offer some clarifications regarding nested classes, since I've been using them quite heavily since early March: 1) nested classes are just like nested functions. You can declare them pretty much wherever you can declare a variable. 2) nested classes are *not* the same as Java inner classes. The latter include a reference to the enclosing parent, whilst the former do not. In Java you have to know the "EnclosingClass.this.method()" incantation to reach the method of an enclosing class (from a child). In D this simply does not exist. Instead, you pass the enclosing class as a constructor argument and reference it in the normal fashion. Note that many nested classes do not need to reference the parent at all ... 3) nested classes are perfectly visible to the outside world. If you have a nested class Bar within enclosing class Foo, a simple Foo.Bar gives you the nested class. That is, new Foo.Bar(); is legitimate syntax. Such talk of "super private" is both badly misguided and misleading. 4) nested classed are the business! As are nested functions. Nice work Walter.
Jun 03 2004
In article <c9o7b0$12g0$1 digitaldaemon.com>, Kris says...3) nested classes are perfectly visible to the outside world. If you have a nested class Bar within enclosing class Foo, a simple Foo.Bar gives you the nested class. That is, new Foo.Bar(); is legitimate syntax. Such talk of "super private" is both badly misguided and misleading.
I didn't think of that. <embarrassed!> Jill
Jun 03 2004
I forgot to mention that there's an outstanding bug related to nested static constructors. See the bug NG for details. "Kris" <someidiot earthlink.dot.dot.dot.net> wrote in message news:c9o7b0$12g0$1 digitaldaemon.com...Thought I'd offer some clarifications regarding nested classes, since I've been using them quite heavily since early March: 1) nested classes are just like nested functions. You can declare them pretty much wherever you can declare a variable. 2) nested classes are *not* the same as Java inner classes. The latter include a reference to the enclosing parent, whilst the former do not. In Java you have to know the "EnclosingClass.this.method()" incantation to reach the method of an enclosing class (from a child). In D this simply
not exist. Instead, you pass the enclosing class as a constructor argument and reference it in the normal fashion. Note that many nested classes do
need to reference the parent at all ... 3) nested classes are perfectly visible to the outside world. If you have
nested class Bar within enclosing class Foo, a simple Foo.Bar gives you
nested class. That is, new Foo.Bar(); is legitimate syntax. Such talk of "super private" is both badly misguided and misleading. 4) nested classed are the business! As are nested functions. Nice work Walter.
Jun 03 2004
Thanks Kris for such a clarification! I think it should be placed to Wiki. "Kris" <someidiot earthlink.dot.dot.dot.net> wrote in message news:c9o7b0$12g0$1 digitaldaemon.com...Thought I'd offer some clarifications regarding nested classes, since I've been using them quite heavily since early March:
Jun 04 2004
No sweat Blanger; upload it if you like ... "Blandger" <zeroman prominvest.com.ua> wrote in message news:c9pdtq$2rj1$1 digitaldaemon.com...Thanks Kris for such a clarification! I think it should be placed to Wiki. "Kris" <someidiot earthlink.dot.dot.dot.net> wrote in message news:c9o7b0$12g0$1 digitaldaemon.com...Thought I'd offer some clarifications regarding nested classes, since
been using them quite heavily since early March:
Jun 04 2004
"Kris" <someidiot earthlink.dot.dot.dot.net> wrote in message news:c9o7b0$12g0$1 digitaldaemon.com...Thought I'd offer some clarifications regarding nested classes, since I've been using them quite heavily since early March: 1) nested classes are just like nested functions. You can declare them pretty much wherever you can declare a variable. 2) nested classes are *not* the same as Java inner classes.
But D's nested classes are the same as Java's nested classes.
Jun 05 2004









Arcane Jill <Arcane_member pathlink.com> 