example union object cpp
#include <iostream>
//example about union struct links
//basic data object
struct Data
{
enum
{
Int,
Bool,
Char,
Pnt
} type;
union
{
int i;
char c;
bool b;
Data* p;
};
};
int main() {
//sample init
Data a = {Data::Bool};
std::cout << a.type << "\n";
}