Hi
I found an interesting piece of code, but the code does not compile.
and i dont know what this special syntax means. I dont know the keyword for google, so searching is quite hard.
class CException
{
friend class AutomaticGuardUnguard;
public:
CException(const std::string &Desc);
std::string getCallStackString();
private:
static void _pushFunction(const char *FuncName);
static void _popFunction();
std::string m_ErrorDescription;
unsigned int m_StackDepth;
static unsigned int ms_StackDepth;
static std::vector<const char*> ms_Vector;
};
unsigned int CException::ms_StackDepth = 0;
std::vector<const char*> CException::ms_Vector;
//------------------------------------------------------------------------
//THIS LINE OF CODE
//constructor():datamember ???
CException::CException(const string &Desc) : m_ErrorDescription(Desc), m_StackDepth(ms_StackDepth)
{
}
The declarition of CException. What does that : m_ErrorDescription(Desc), m_StackDepth(ms_StackDepth)
mean?
I know that those both are data member, but i dont know what this double point means in that context.
The compiler complains about the return type of the ctr. (If i add anything, he complains, that ctrs must not have any return type).
1>Compiling...
1>main.cpp
1>c:\documents and settings\ben\desktop\prometha\header\exception.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ben\desktop\prometha\header\exception.h(39) : error C2143: syntax error : missing ',' before '&'
1>c:\documents and settings\ben\desktop\prometha\header\exception.h(39) : error C2511: 'CException::CException(const int)' : overloaded member function not found in 'CException'
1> c:\documents and settings\ben\desktop\prometha\header\exception.h(17) : see declaration of 'CException'