在 C++ 中类名后使用冒号 [英] Use of colon after class name in c++

查看:34
本文介绍了在 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.

这篇关于在 C++ 中类名后使用冒号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆