differentiating derived classes

let's say I have a class B and 2 classes A and C that are derived from B.

If I have a vector of B's and I fill it with A's and C's, is there any way to tell if a given object is an A or a C?
If they are polymorphic, use the typeid operator or dynamic_cast operator. Otherwise, you're out of luck.

Why do you need to know this? This sounds like a design flaw...every time you need to know the derived type, whatever you need that information for can be achieved a different way.
Last edited on
If you want to differentiate As from Cs, ¿why do you them in the same bag?
Topic archived. No new replies allowed.