Alex Rivera | Logout

How do I check if an object's type is a particular subclass in C++?

Asked 2008-11-21T03:41:51.010
122

I was thinking along the lines of using typeid() but I don't know how to ask if that type is a subclass of another class (which, by the way, is abstract)

Edit
Report

1 Answer

1

You can only do it at compile time using templates, unless you use RTTI.

It lets you use the typeid function which will yield a pointer to a type_info structure which contains information about the type.

Read up on it at Wikipedia

answered 2008-11-21T03:55:55.040

Your Answer