Created
August 12, 2013 08:10
-
-
Save zakky-dev/6209011 to your computer and use it in GitHub Desktop.
privateメンバにアクセスできてる?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
struct Structure { | |
public: | |
int public_integer = 10; | |
private: | |
int private_integer = 20; | |
} | |
void main() { | |
Structure s; | |
with(s) { | |
writeln(public_integer); | |
writeln(private_integer); | |
public_integer = 30; | |
private_integer = 40; | |
writeln(public_integer); | |
writeln(private_integer); | |
} | |
s.public_integer = 50; | |
s.private_integer = 60; | |
writeln(s.public_integer); | |
writeln(s.private_integer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
解決。
D言語の仕様で、同じモジュール内ならprivateでも見えるとのこと。