D - inner classes
- Phill (9/9) Apr 03 2004 Is this URL not up to date?
- Matthias Becker (2/6) Apr 04 2004 It does? I didn't know about it. Thanks for telling me. Or do you mix it...
- Phill (25/33) Apr 04 2004 The difference seems to be a bit blurred to me,
- Phill (10/10) Apr 04 2004 But then again:
- Ivan Senji (7/12) Apr 04 2004 within
- Ant (8/23) Apr 04 2004 I don't know why we don't have them.
- Ivan Senji (6/29) Apr 04 2004 instance
- Ant (32/63) Apr 04 2004 We agree. I do that with nested classes,
- Manfred Nowak (5/6) Apr 04 2004 [...]
- Ant (3/12) Apr 04 2004 you only have one enclosing instance for all the inners you instanciate.
- Phill (29/43) Apr 04 2004 I just do this(as im sure a lot of other people do)
Is this URL not up to date? http://www.digitalmars.com/d/comparison.html I noticed that it states that D doesnt have inner classes, but as you know it does. Phill. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
Apr 03 2004
Is this URL not up to date? http://www.digitalmars.com/d/comparison.html I noticed that it states that D doesnt have inner classes, but as you know it does.It does? I didn't know about it. Thanks for telling me. Or do you mix it up with nested classes? Nested classes != inner classes!!!
Apr 04 2004
The difference seems to be a bit blurred to me, after reading this quote from this URL: ======================== Like other members, a nested class can be declared static (or not). A static nested class is called just that: a static nested class. A nonstatic nested class is called an inner class. These are illustrated in the following code: class EnclosingClass{ . . . static class AStaticNestedClass { . . . } class InnerClass { . . . } } =================================== http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html Phill. "Matthias Becker" <Matthias_member pathlink.com> wrote in message news:c4ofkm$21ld$1 digitaldaemon.com...up withIs this URL not up to date? http://www.digitalmars.com/d/comparison.html I noticed that it states that D doesnt have inner classes, but as you know it does.It does? I didn't know about it. Thanks for telling me. Or do you mix itnested classes? Nested classes != inner classes!!!--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
Apr 04 2004
But then again: Definition: An inner class is a nested class whose instance exists within an instance of its enclosing class and has direct access to the instance members of its enclosing instance. So it is clearly not an Inner class that D has..... Phill. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
Apr 04 2004
"Phill" <phill pacific.net.au> wrote in message news:c4ogmn$22un$1 digitaldaemon.com...But then again: Definition: An inner class is a nested class whose instance existswithinan instance of its enclosing class and has direct access to the instance members of its enclosing instance. So it is clearly not an Inner class that D has.....I was thinking about how great would it be to have that but i didn't know it is called inner class. It would solve a big design problem in one of my projects!
Apr 04 2004
On Sun, 04 Apr 2004 16:50:53 +0200, Ivan Senji wrote:"Phill" <phill pacific.net.au> wrote in message news:c4ogmn$22un$1 digitaldaemon.com...I don't know why we don't have them. for your design problems just pass a pointer of the outer (nesting?) class to the nested class I do it all the time. I can't believe that it would be any problem at all to add inner classes to the language. AntBut then again: Definition: An inner class is a nested class whose instance existswithinan instance of its enclosing class and has direct access to the instance members of its enclosing instance. So it is clearly not an Inner class that D has.....I was thinking about how great would it be to have that but i didn't know it is called inner class. It would solve a big design problem in one of my projects!
Apr 04 2004
"Ant" <duitoolkit yahoo.ca> wrote in message news:pan.2004.04.04.14.00.38.516985 yahoo.ca...On Sun, 04 Apr 2004 16:50:53 +0200, Ivan Senji wrote:instance"Phill" <phill pacific.net.au> wrote in message news:c4ogmn$22un$1 digitaldaemon.com...But then again: Definition: An inner class is a nested class whose instance existswithinan instance of its enclosing class and has direct access to theknow itmembers of its enclosing instance. So it is clearly not an Inner class that D has.....I was thinking about how great would it be to have that but i didn'tI would do it too but i have some really small classes (not so many data) and the inner classes solution would be much nicer.is called inner class. It would solve a big design problem in one of my projects!I don't know why we don't have them. for your design problems just pass a pointer of the outer (nesting?) class to the nested class I do it all the time.I can't believe that it would be any problem at all to add inner classes to the language. Ant
Apr 04 2004
On Sun, 04 Apr 2004 22:26:52 +0200, Ivan Senji wrote:"Ant" <duitoolkit yahoo.ca> wrote in message news:pan.2004.04.04.14.00.38.516985 yahoo.ca...We agree. I do that with nested classes, and the nested class is a friend of the outer class so it has access to all it's members. this compiles and runs as expected: public class A { private int a; this() { new B(this); } private class B { int a; this(A outerClassThatIsAFriend) { outerClassThatIsAFriend.a = 1; a = 23; printf("B.this outerClassThatIsAFriend.a = %d\n", outerClassThatIsAFriend.a); printf("B.this a = %d\n", a); } } } int main(char[][] args) { new A; return 0; } AntOn Sun, 04 Apr 2004 16:50:53 +0200, Ivan Senji wrote:instance"Phill" <phill pacific.net.au> wrote in message news:c4ogmn$22un$1 digitaldaemon.com...But then again: Definition: An inner class is a nested class whose instance existswithinan instance of its enclosing class and has direct access to theknow itmembers of its enclosing instance. So it is clearly not an Inner class that D has.....I was thinking about how great would it be to have that but i didn'tI would do it too but i have some really small classes (not so many data) and the inner classes solution would be much nicer.is called inner class. It would solve a big design problem in one of my projects!I don't know why we don't have them. for your design problems just pass a pointer of the outer (nesting?) class to the nested class I do it all the time.
Apr 04 2004
Ant wrote:I don't know why we don't have them.[...] What is the difference between an inner class and a nested class which is derived from its enclosing class? So long!
Apr 04 2004
On Mon, 05 Apr 2004 04:24:57 +0200, Manfred Nowak wrote:Ant wrote:you only have one enclosing instance for all the inners you instanciate. AntI don't know why we don't have them.[...] What is the difference between an inner class and a nested class which is derived from its enclosing class? So long!
Apr 04 2004
I just do this(as im sure a lot of other people do) --------------------- class outer { char[] test = "hi there"; this() { new inner("outer"); } class inner : Frame { this(char[] str) { outer o; printf(o.test); } }//end inner }//end outer You can do exactly the same with methods ie: outer o; o.doIt(); Phill. "Ivan Senji" <ivan.senji public.srce.hr> wrote in message news:c4p7bv$bi$1 digitaldaemon.com..."Phill" <phill pacific.net.au> wrote in message news:c4ogmn$22un$1 digitaldaemon.com...itBut then again: Definition: An inner class is a nested class whose instance existswithinan instance of its enclosing class and has direct access to the instance members of its enclosing instance. So it is clearly not an Inner class that D has.....I was thinking about how great would it be to have that but i didn't knowis called inner class. It would solve a big design problem in one of my projects!--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
Apr 04 2004