Why union static members not stored as a union?
问题 In C++ union can contain static members which, as in the case of classes, belong to a class and therefore are common to all objects. union U { long l; int i; static long sl; static int si; }; int U::si; long U::sl; It would be logical to expect that all the union static members stored at the same address similar to non-static members storing. But it is not. A simple example shows that static members are stored under different addresses and can contain independent values. int main() { U u; u