什么是RTTI What is RTTI

来源:互联网 发布:淘宝怎么验证 编辑:程序博客网 时间:2024/05/20 04:46

RTTI即运行时类型识别,用来识别动态对象的类型。即使我们仅仅有基类的指针和引用,可以识别出该指针和引用所指向那个类(基类或派生类)。RTTI会带来一定的性能开销。

 

Runtime type identification allows us to find the dynamic type of an object when we have only a pointer or a reference of the base type. It comes at a cost of performance penalty.