digitalmars.D - "inner" keyword (for 2.0)
- Id (4/4) Aug 30 2004 Since the "private" keyword also allows access to members in the same mo...
- Ilya Minkov (6/10) Aug 31 2004 It was decided against such a restriction, because one module is
- =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= (2/18) Aug 31 2004
- Ivan Senji (37/41) Aug 31 2004 module,
Since the "private" keyword also allows access to members in the same module, what about adding (for 2.0) the keyword "inner" to specify an attribute that behaves like Java's private? (That is, an attribute that only the class itself can access).
Aug 30 2004
Id schrieb:Since the "private" keyword also allows access to members in the same module, what about adding (for 2.0) the keyword "inner" to specify an attribute that behaves like Java's private? (That is, an attribute that only the class itself can access).It was decided against such a restriction, because one module is probably maintained by the same person or a group of people, and if they really need to make nonsense within such a small scope... well, there is nothing that could possibly stop them. -eye
Aug 31 2004
Also, it doesn't start with a "p" :p Ilya Minkov wrote:Id schrieb:Since the "private" keyword also allows access to members in the same module, what about adding (for 2.0) the keyword "inner" to specify an attribute that behaves like Java's private? (That is, an attribute that only the class itself can access).It was decided against such a restriction, because one module is probably maintained by the same person or a group of people, and if they really need to make nonsense within such a small scope... well, there is nothing that could possibly stop them. -eye
Aug 31 2004
"Id" <Id_member pathlink.com> wrote in message news:ch05hl$2vgb$1 digitaldaemon.com...Since the "private" keyword also allows access to members in the samemodule,what about adding (for 2.0) the keyword "inner" to specify an attributethatbehaves like Java's private? (That is, an attribute that only the class itself can access).What would be nice is: to have inner classes (by this I mean a class nested in another class and whose objects can only be created from within the parent class and an object of this inner class holds implicitly a reference to its parent class. So something like class A { class B { this(A parent) { this.parent = parent; } A parent; } void func() { B b = new B(this); } } would be the same as: class A { inner class B { this(){} } void func() { B b = new B(); } }
Aug 31 2004