Object orientated code could break down dangerously when using static class members in an unorthodox manner. Static initialization sequence goes like this:
1. Program starts, mark all classes that has static members as statically uninitialized.
2. Enters a scope where static calls are made.
3. Check, in order of execution sequence, get the first class in scope that is statically uninitialized.
5. Enter class scope, mark current scope as visited and Goto (7) if one of these are true:
– No static calls in current scope
– All classes have been marked as initialised
– All classes have been marked as visited.
6. Goto (3)
7. Initialize all class static members with values in sequence
8. Resume (2)