Original Post
Arg. I hope some of you big brained C++ guru's can help me with this one, my smooth round brain cant seem to figure it out!
The actual code too big to post, so i'll just explain my problem in a general way here. .... here goes! (takes deep breath.)
-------------
There is a virtual class 'Super' and it contains one member, a static variable lets call the variable 'm_SomeVar'.
Now, there exists another class 'Derived'. It is derived from 'Super'. Its constructor modifies the static variable 'm_SomeVar' in Super.
As far as I know, so far everything is legitimate and valid.
Now.. Where my problem occurs is if I create a static instance of 'Derived' -- it gives me crazy access violation errors when its constructor is executed. It seems as though 'm_SomeVar' has not yet been fully created EVEN THOUGH the constructor for 'Super' has already been called.
Its my understanding that the order in which static variables are initialized is undefined by the C++ standard, BUT ... arent static members of classes initialized before static members of derived classes?
If you think you can help me, but need me to clarify or rephrase just ask.
---------
I have been struggling with this problem for months, so I would really appreciate it if you could help me determine:
I) What is going on exactly.
II) If this is a logic error on my part, or a compiler problem.
III) If its a logic error, how else can I do this?
IV) If its a compiler problem, how do I work around it!?
Thanks in advance!
- Jacob
[edited by - Kevlar-X on December 14, 2002 4:24:16 AM]