I have a class with a static function getSharedInstance, thus should give me a pointer to an already instanced version of the class.
Header:
class foo {
public:
static foo *getSharedInstance();
private:
static foo *sharedInstance;
}
Implementation:
foo *foo::getSharedInstance() {
if(sharedInstance == NULL)
sharedInstance = new foo();
return sharedInstance;
}
The point I don't understand is, why do I get undefined reference to the variable sharedInstance?