How do I access member variables inside an overridden base class function?
//Overridden base class function
void handleNotification(s3eKey key){
//Member variable of this class
keyPressed = true; //Compiler thinks this is undeclared.
}
Complier is complaining that keyPressed is not declared. The only way I can figure out how to access it is declare keyPressed as a public static variable and then use something like:
ThisClass::keyPressed = true;
What am I doing wrong?
//Added details-----------------------------------------------------------
ThisClass.h:
include "BaseClass.h"
class ThisClass: public BaseClass {
private:
bool keyPressed;
};
ThisClass.cpp:
include "ThisClass.h"
//Overridden BaseClass function
void handleNotification(s3eKey key){
//Member variable of ThisClass
keyPressed = true; //Compiler thinks this is undeclared.
}
BaseClass.h:
class BaseClass{
public:
virtual void handleNotification(s3eKey key);
};
BaseClass.cpp
include 'BaseClass.h"
void BaseClass::handleNotification(s3eKey key) {
}