I have Class A extending Class B and implementing Interface C. B accesses a protected var x from A. But the compiler is telling me that x is not declared in this scope. The code looks like
Sender.h
MyListener.hCode:#include "properties.h" class Sender { public: Sender(Properties p); protected int sock; int getSocket(); };
MyListener.cppCode:#include "sender.h" class MyListener : public Sender, public Listener { public: void on_ready(); int getSocket(); };
Compiling MyListener.cpp causes a "'sock' was not declared in this scope" error.Code:#include "mylistener.h" int MyListener::getSocket() { return sock; }



LinkBack URL
About LinkBacks


