posted 18 years ago
When I read Design FAQ of Assertion, I found such an entry(the last entry on the bottom of the page):
8. Why does an assert statement that executes before its class is initialized behave as if assertions were enabled in the class?
Few programmers are aware of the fact that a class's constructors and methods can run prior to its initialization. When this happens, it is quite likely that the class's invariants have not yet been established, which can cause serious and subtle bugs. Any assertion that executes in this state is likely to fail, alerting the programmer to the problem. Thus, it is generally helpful to the programmer to execute all assertions encountered while in this state.
I know the fact that a class'e constructors and methods can run before its initialization complete, but I still don't understand what the FAQ says.
Anyone can help me please?
Stephen Suen