The similarities between unions, structures, and classes in C++ goes a little further then might be expected. In C++, unions and classes may also include the protected , private , and public , as well as constructors, destructors, and other member functions. In fact, the struct is converted into a class by the C++ compiler. The only difference between these types is that union and struct members are public by default, where in a class the default is private .