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

前端 未结 5 1161
鱼传尺愫
鱼传尺愫 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:08

    In modern C++ there is no point.

    Frameworks dating from before the 1998 standardization may offer an IsA function.

    E.g. as I recall there is such functionality in MFC.

    Also, as you note, when dealing with objects implemented in other languages (with types not represented by C++ types) it may conceivably be useful.

    Cheers & hth.,

提交回复
热议问题