Hello everyone. I've never used friend classes before, but just today I found (a very large) use for them in a project of mine. Anyway, what im doing is this:
But when I try to compile it, it tells me that 'tester' is not a member or Cblah. Now, it isn't, but shouldn't the friend to test allow it to access 'tester'? I may be totally wrong about how friends work, so could someone tell me either what im doing wrong or set friends straight? Thanks.Code:class test { public: int tester; }; class Cblah { public: int type; friend test; }; ...(later on) Cblah bob; ...(later) if(bob.tester==1) { ... }



LinkBack URL
About LinkBacks



