When is runtime type checking ok and when is it a bad design?
Usually, a mention of checking the type of a variable at runtime results in a comment about bad design. Sometimes it seems like it can't be avoided. I would like to see examples of when runtime type checking is good design. I'd be especially interested in C++ or Java examples.

I recently asked a specific question involving this topic, but I wanted to ask the more general question. I saw this question: <http://stackoverflow.com/questions/447947/is-type-checking-ever-ok>
but it didn't really cover what I wanted to know. 

Thanks in advance.

When is runtime type checking ok and when is it a bad design?
===

Usually, a mention of checking the type of a variable at runtime results in a comment about bad design. Sometimes it seems like it can't be avoided. I would like to see examples of when runtime type checking is good design. I'd be especially interested in C++ or Java examples.

I recently asked a specific question involving this topic, but I wanted to ask the more general question. I saw this question: <http://stackoverflow.com/questions/447947/is-type-checking-ever-ok>
but it didn't really cover what I wanted to know. 

Thanks in advance.
