|
-
Mar 3rd, 2003, 12:44 AM
#1
Thread Starter
Addicted Member
Static member assignment
Can I assign a value to a static public memeber in a class?
NOMAD
-
Mar 3rd, 2003, 05:00 AM
#2
Hyperactive Member
Code:
MyClass::MyStaticMember = 2; //Assuming MyStaticMember is a integer
-
Mar 4th, 2003, 12:46 PM
#3
Thread Starter
Addicted Member
Do I need to have an instance of my class declared? I tried that and I'm getting linker errors in MSVC++ 6 saying unresolved symbol
-
Mar 5th, 2003, 06:32 AM
#4
Frenzied Member
Maybe I'm missing something, but what's the point in using a static member if you don't plan to instantize your class?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Mar 5th, 2003, 12:25 PM
#5
Thread Starter
Addicted Member
I wanted to use initialize it by my main program. Then use it with the class function (reather the constructer). I know that sounds pretty dangerous but as long as I document thats how it works I think it should be alright.
NOMAD
PS I made them public static int seems to work great.
Thanks everyone!
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
|