Can a union in C++ have a member function? How do union with data members and member functions exist if an object is created?
If I suppose yes, then are they feasible an
I don't know if it's valid. Codepad accepts, runs, and gives the expected output from this program
union x { int t; int k() { return 42;}; }; int main() { x y; y.t = y.k(); std::cout << y.t << std::endl; }