Reputation: 315
What are some major differences between unions in C and C++?
Upvotes: 3
Views: 493
Reputation: 234835
In a nutshell, a C++ union
can have constructors and destructors, and non-virtual functions. (Note that a C++ union
cannot have a base class and cannot be a base class.)
Everything else is pretty much the same between C and C++.
Upvotes: 9