2008. 8. 11. 11:28
Initializing Static Members (C++ 에서 정적 멤버 초기화)
2008. 8. 11. 11:28 in 3. Implementation/C / C++

Static member initialization occurs in class scope. Therefore, they can access other member data or functions. For example:
// initializing_static_members.cpp
class DialogWindow
{
public:
static short GetTextHeight()
{
return 1;
};
private:
static short nTextHeight;
};
class DialogWindow
{
public:
static short GetTextHeight()
{
return 1;
};
private:
static short nTextHeight;
};
short DialogWindow :: nTextHeight = GetTextHeight();
int main()
{
}
int main()
{
}
Note that in the preceding definition of the static member nTextHeight, GetTextHeight is implicitly known to be DialogWindow :: GetTextHeight.
출처 : http://msdn.microsoft.com/en-us/library/8yc35419(VS.80).aspx