www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - struct access specifiers

reply imr1984 <imr1984_member pathlink.com> writes:
private/public work inside a struct, but they have no effect on the access level
of the structs members (private/public are not implemented in structs).

Could access specifiers be implemented for structs? This would be great.
Apr 15 2005
parent "Carlos Santander B." <csantander619 gmail.com> writes:
imr1984 wrote:
 private/public work inside a struct, but they have no effect on the access
level
 of the structs members (private/public are not implemented in structs).
 
 Could access specifiers be implemented for structs? This would be great.
 
 

Confirmed. (cross-posted to bugs ng) //---------------------------------- // file a.d struct A { public int x; private char y; } //---------------------------------- // file b.d import a; void main() { A a; a.x=1; a.y='a'; } //---------------------------------- Compiles and runs when it shouldn't. -- Carlos Santander Bernal JP2, you'll always live in our minds
Apr 15 2005