When are static class variables initialized during runtime?

Posted by Jake on Stack Overflow See other posts from Stack Overflow or by Jake
Published on 2010-05-24T14:50:58Z Indexed on 2010/05/24 15:01 UTC
Read the original article Hit count: 210

Filed under:
|
|
|

Hi,

I have the following:

class Thing
{
   static Thing PREDEFINED;
   type _private;

   Thing() { _private = initial_val; }
}

Thing Thing::PREDEFINED = redefined_val;

in global scope, i have this

Thing mything = Thing::PREDEFINED;

but it does not have the desired effect. mything is still initial_value and there were no errors too.

So, may I ask when is the static class variable initialized during runtime?

© Stack Overflow or respective owner

Related posts about c++

Related posts about class