Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 30, 2004 "inner" keyword (for 2.0) | ||||
---|---|---|---|---|
| ||||
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). |
August 31, 2004 Re: "inner" keyword (for 2.0) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Id | 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
|
August 31, 2004 Re: "inner" keyword (for 2.0) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Id | "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 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). > 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(); } } |
August 31, 2004 Re: "inner" keyword (for 2.0) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | 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
|
Copyright © 1999-2021 by the D Language Foundation