MFC, Singleton inplementeringsproblemer
Ville høre om der er nogen der kan hjælpe mig... jeg får følgende fejlmeddelelse...mainmenu error LNK2001: unresolved external symbol "private: static class CBarn * CBarn::_instance" (?_instance@CBarn@@0PAV1@A)
Det er som om jeg ikke har lov til at pille ved pointeren _instance...
////////header
#include "arvklasse.h"
class CBarn : public CArvklasse
{
public:
static CBarn* Instance();
protected:
CBarn();
private:
static CBarn* _instance;
};
////// cpp fil
#include "CBarn.h"
CBarn::CBarn()
{
}
CBarn* CBarn::Instance()
{
if ( _instance == 0 )
_instance = new CBarn;
return _instance;
}