If I have a class that has a private static varible (say and int statInt) how do I initialize it. I can't do it in constructor because it exists for all class obj...
What is the correct syntax for this?
NOMAD
Printable View
If I have a class that has a private static varible (say and int statInt) how do I initialize it. I can't do it in constructor because it exists for all class obj...
What is the correct syntax for this?
NOMAD
Z.Code:class a
{
private:
static int v;
public:
void m();
};
int a::v = 0;
void a::m()
{
}
oh well i guess that logical (*wink*)
NOMAD
And if I placed the static varible in the public section could I do a::v = 0 from my main? If so does it require an instance of the class to be instanciated? Then would I use the the . operator?
NOMAD
No, it's the same syntax no matter what the visibility is.