- 7 名前:デフォルトの名無しさん mailto:sage [2007/05/06(日) 22:33:07 ]
- >>5
#include <iostream> using namespace std; class Outer { friend class Inner; class Inner { Outer& outer; public: Inner(Outer* theOuter) : outer(*theOuter) { } void hoge() { cout << outer.foo << endl; } }; private: int foo; public: Outer() : foo(3) { } void hoge() { Inner inner(this); inner.hoge(); } }; int main() { Outer outer; outer.hoge(); }
|

|