在 C++ 中类名后使用冒号
这是从 blackberry 10 helloworld 程序中提取的头文件.
This is a header file extracted from a blackberry 10 helloworld program.
#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_
#include <QObject>
namespace bb
{
namespace cascades
{
class Application;
class LocaleHandler;
}
}
class QTranslator;
/*!
* @brief Application object
*
*
*/
class ApplicationUI : public QObject
{
Q_OBJECT
public:
ApplicationUI(bb::cascades::Application *app);
virtual ~ApplicationUI() { }
private slots:
void onSystemLanguageChanged();
private:
QTranslator* m_pTranslator;
bb::cascades::LocaleHandler* m_pLocaleHandler;
};
#endif /* ApplicationUI_HPP_ */
我对类名声明后的冒号运算符感到困惑.
I am confused about the colon operator right after the class name declaration.
class ApplicationUI : public QObject
这是什么意思?
推荐答案
表示ApplicationUI
继承了QObject
类的所有方法和成员变量.public
的使用意味着QObject
的公共方法和成员在ApplicationUI
中也是公共的.
It means that ApplicationUI
inherits all methods and member variables from the class QObject
. The use of public
means that the public methods and members of QObject
are also public in ApplicationUI
.
相关文章