What is qobject_cast?
问题 Could someone explain in as simple terms as possible (or as simple as you would like) what qobject_cast is, what it does and why we would need to cast one class type to another? Like, I get typecasting in the sense of casting an int as a char or QString maybe to use QMessageBox , but why cast into different classes? 回答1: Before you start learning what qobject_cast is, you would need to know what C++'s dynamic_cast is. Dynamic cast is all about polymorphism. C++'s dynamic cast uses RTTI (Run