RTTI是”Runtime Type Information”的缩写,意思是运行时类型信息,它提供了运行时确定对象类型的方法。 typeid函数 对于c++的内置数据类型,typeid可以方便的输出它们的数据类型。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 #include <iostream> #include <typeinfo> using namespace std; int main() { short s = 2; unsigned ui = 10; int i = 10; char ch = 'a'; wchar_t wch = L'b'; float f = 1.……

阅读全文