Witam, automatycznie tworzę klasę Project -> Add Class w Visual Studio 2010. Normlane, że genrują się dwa pliki ( .h oraz .cpp ), gdzie w .h umieszczam metody, a w .cpp je implementuje. Załóżmy, że mam taką klasę:
static bool instanceFlag;
static singleton *single;
Singleton()
{
//private constructor
}
public:
static singleton* getInstance();
void method();
~singleton()
{
instanceFlag = false;
}
Prosty singleton. Nie potrafię go przenieść na Visuala, po prostu nawet jak go wkleje to mam takie błędy:
- cannot use thid indirection on type "singleton"
- cannot define a compiler-generated special member function (must be declared in the class first)
Pytam ponieważ dotychczas podczas nauki programowania obiektowego, bez problemu poruszałem się w klasach.
Pozdrawiam