D
Dart
This code is okay:
class CSingle
{
public:
static CSingle membs;
int MEM_NUM;
CSingle(int n)
{
}
};
CSingle CSingle::membs(5);
However if it's changed as:
class CSingle
{
public:
static CSingle membs;
int MEM_NUM;
CSingle()
{
}
};
CSingle CSingle::membs();
Compiler spits errors:
error C2063: 'membs' : not a function
error C2040: 'membs' : 'class CSingle (void)' differs in levels of
indirection from 'class
Does anyone know the reason for the problem?
Is this a good way to implement Singleton? Thanks!
class CSingle
{
public:
static CSingle membs;
int MEM_NUM;
CSingle(int n)
{
}
};
CSingle CSingle::membs(5);
However if it's changed as:
class CSingle
{
public:
static CSingle membs;
int MEM_NUM;
CSingle()
{
}
};
CSingle CSingle::membs();
Compiler spits errors:
error C2063: 'membs' : not a function
error C2040: 'membs' : 'class CSingle (void)' differs in levels of
indirection from 'class
Does anyone know the reason for the problem?
Is this a good way to implement Singleton? Thanks!