Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
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;
};
short DialogWindow :: nTextHeight = GetTextHeight();
int main()
{
}
Note that in the preceding definition of the static member nTextHeight, GetTextHeight is implicitly known to be DialogWindow :: GetTextHeight.