C ++中的IsA()的意义是什么? [英] What's the point of IsA() in C++?
问题描述
我想弄清楚为什么一些代码库使用IsA()来确定对象多态性,如果在C ++中你已经可以安全地向上和向下转换(使用dynamic_cast)?
到目前为止,我看到的有用的唯一情况是当你集成aa脚本环境,链接到c ++代码库?
谢谢!
$ b在1998年标准化之前的框架可能会出现这种情况。提供IsA函数。
例如因为我记得在MFC中有这样的功能。
另外,当你注意到,当处理在其他语言(没有用C ++类型表示的类型)可能是有用的。
hth。,
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 far the only case I see useful is when you are integrating a a scripting environment that is linked to the c++ codebase?
Thanks!
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.,
这篇关于C ++中的IsA()的意义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!