runtime-type

When to use run-time type information?

If I have various subclasses of something, and an algorithm which operates on instances of those subclasses, and if the behaviour of the algorithm varies slightly depending on what particular subclass an instance is, then the most usual object-oriented way to do this is using virtual methods. For example if the subclasses are DOM nodes,...

runtime determine type for C

If the type of a variable must be determined as runtime in C but the variable name is fixed and given, is there any way to reuse the code that involves the variable? Actually I am asking about the C counterpart situation of runtime determine type for C++. If possible please give some examples. ...