Say I have two classes, ClassA and ClassB.
ClassB inherits ClassA, and has some additional functions and variables.
Is it possible for me to make a function that can accept either ClassA or ClassB as the same argument, and let me determine which one was used?
Yes, you can take the parameter by reference:
You’ll be able to pass both instances of
ClassAorClassB, and use RTTI to determine which type it actually is inside the function.Alternatively, you can pass a pointer to
ClassA, but references are to be preferred where possible.