What could cause a dynamic_cast to crash?

前端 未结 6 1077
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-06 16:58

I have a piece of code looking like this :

TAxis *axis = 0;
if (dynamic_cast(obj))
   axis = (dynamic_cast         


        
6条回答
  •  悲&欢浪女
    2020-12-06 17:35

    dynamic_cast will return 0 if the cast fails and you are casting to a pointer, which is your case. The problem is that you have either corrupted the heap earlier in your code, or rtti wasn't enabled.

提交回复
热议问题