#include <iostream>
#include <string>

using namespace std;

class Thing {
	int a;
public:
    Thing(int v = 0): a (v) {}
	const char * type_name(){ return "Thing"; }
	int value() { return a; }
};

class OtherThing : public Thing {
public:
	OtherThing(int v): Thing(v) {}
	
	const char * type_name() { return "Other Thing"; }
};

union Something {
	Something(int v) : t(v) {}
	Thing t;
	OtherThing ot;
};

int main() {
	Something sth{42};
	std::cout << sth.t.type_name() << "\n";
	std::cout << sth.t.value() << "\n";
	
	std::cout << sth.ot.type_name() << "\n";
	std::cout << sth.ot.value() << "\n";
	return 0;
}