What does it mean when a class declaration appears to have two names?

后端 未结 3 787
渐次进展
渐次进展 2021-02-05 17:49

I\'m trying to understand some C++ code which has the following class syntax:

class Q_MONKEY_EXPORT BasePlugin : public QObject
{
    // some code comes here
};
         


        
3条回答
  •  旧巷少年郎
    2021-02-05 18:30

    Q_MONKEY_EXPORT is most likely a #define somewhere. Defines like that are sometimes required, for example when the class is in a library and needs to be exported when the header file is included from somewhere else. In that case, the define resolves to something like __declspec(dllexport) (the exact syntax will depend on the tools you are using).

提交回复
热议问题