union [C++ Reference]
Keywords: keywords,union
Date: 2008-10-14T15:42:05-0700

[[union]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## union

Syntax:

        union union-name {
        public-members-list;
        private:
        private-members-list;
        } object-list;

A union is like a class, except that all members of a union share the same memory location and are by default public rather than private. For example:

         union Data {
           int i;
           char c;
         };

Related Topics: class, struct

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •