Union of same type in C++

后端 未结 3 1893
一向
一向 2021-01-17 23:06

Whenever I see examples of union, they are always different types. For example, from MSDN:

// declaring_a_union.cpp
union DATATYPE    // Declare union type
{         


        
3条回答
  •  醉话见心
    2021-01-17 23:32

    No, this won't cause any issues. The reason you don't see it more often is that it's pointless - both names refer to the same value of the same type.

提交回复
热议问题