How can I check the types of derived classes in C++?
问题 Let's say I have some base abstract class and three different classes that derive and implement its methods. Is there is a 'Type' object like as in C#? Or in other words, how do I get instances of all these classes? #ModuleBase.cpp class ModuleBase { }; #Module1.cpp class Module1 : public virtual ModuleBase { }; #Module2.cpp class Module2 : public virtual ModuleBase { }; #Module3.cpp class Module3 : public virtual ModuleBase { }; 回答1: You can create instanceof like methods that can detect the