Unions
Similar to a structure, but the different data fields all sharre the same location in memory.
// can hold an int, a double, OR a pointer
union myUnion {
int i;
double d;
anObject * p;
};
Object-oriented languages made unions unnecessary by introducing polymorphic variables
Previous slide
Next slide
Back to first slide
View graphic version