A union is a special kind of class. The data members in a union are stored in memory in such a way that they overlap each other. Each member begins at the same memory address. The amount of storage allocated for a union is the amount necessary to contain its largest data member. Only one member at a time may be assigned a value.
Union is a special kind of class. The data members of a union are overlapped in memory. Each data member has the same memory address. The size of a union is determined by the size of the biggest data member which the union contains. Any time only one member can be assigned with a value.