What's the point of IsA() in C++?

前端 未结 5 1151
鱼传尺愫
鱼传尺愫 2021-02-10 16:14

I\'m trying to figure out why some code bases use IsA() to determine object polymorphism if in C++ you can already safely upcast and down cast (using dynamic_cast) ?

So

5条回答
  •  遇见更好的自我
    2021-02-10 17:17

    Because dynamic-cast relies on RTTI, and this can hurt performance. It is also a bit more convinient and reliable.

提交回复
热议问题