|
-
Feb 6th, 2003, 12:58 AM
#1
Thread Starter
Addicted Member
Initializing a static varible
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
-
Feb 6th, 2003, 01:07 AM
#2
Frenzied Member
Code:
class a
{
private:
static int v;
public:
void m();
};
int a::v = 0;
void a::m()
{
}
Z.
-
Feb 6th, 2003, 01:37 AM
#3
Thread Starter
Addicted Member
oh well i guess that logical (*wink*)
NOMAD
-
Mar 4th, 2003, 12:49 PM
#4
Thread Starter
Addicted Member
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
-
Mar 7th, 2003, 02:43 PM
#5
No, it's the same syntax no matter what the visibility is.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|