21 Sep
2009
21 Sep
'09
2:44 p.m.
Since your types are known at compile time, I think this belongs to the class of problems that systems programmers would traditionally solve with bit masks.
What you're looking for seems to be dynamic_cast.
But I think you're seeking a solution with more explicit support from the language. Yes if you lay it out as a class hierarchy then I agree with Mathias that dynamic_cast should work well. Kevin