This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Nested friend classes don't have access


I figured it out. Sorry about that.

class C {
  int i;
public:
  C(int ii) : i(ii), d(this) {}
  class D;
  friend class C::D;
  class D {
    C* c;
  public:
    D(C* cc) : c(cc) {}
    int f() { return c->i; }
  } d;
};

=============================
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java" & "Thinking in C++ 2e"




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]