I frequently link objects to their parents using:
Video parent;
Sometimes I have objects that can be children of different object types, so do I:
int parentType;
Video parentVideo; // if parent == VIDEO then this will be used
Audio parentAudio; // if parent == AUDIO then this will be used
Is there a better way? How do I work with a variable that can be an instance of different types?
Edit: Of course, if Video and Audio inherit from the same baseclass (eg. Media) I could do this:
Media parent;
But what if the parents do not inherit from the same baseclass?