In C# 4.0, you can use the “dynamic” keyword as a placeholder for a type that is not known until runtime. There are certain corner cases where this is extremely useful behavior. Is it possible to emulate anything like this in C++, possibly using C++0x features or RTTI?
Share
Not really. The closest you can get is a
void *, but you still need to cast it to an appropriate type before you can use it.Update:
You can go about this in at least two ways:
Union-based variant
Polymorphic class heirarchy