It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




7年前关闭。




Qt中有这样的功能:QMetaObject::invokeMethod(QObject * obj, const char * member, ...),它从字符串(成员)调用方法。我该怎么做(或类似)?谢谢)

最佳答案

您不能在纯C++中做到这一点,但是您可以在this问题中阅读有关C++中的反射/不透视的信息

关于c++ - C++从字符串调用方法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14321974/

10-12 17:12