C++ Language/Objects/LowLevelCStructures/Union

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A struct CRType {...}; is the same as class CRType {...}; except for default accessibility.

A union CRType {...}; is also the same, except all members in the union overlap in memory (space in memory is made for the largest member). Only one member can have meaningful data at one time.

Additional information about union