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
What does this mean?
It's commonly used to pack lots of values into an integral type. In your particular case, it defining the structure of a 32-bit microcode instruction for a (possibly) hypothetical CPU (if you add up all the bit-field lengths, they sum to 32).
The base class is specified by adding a colon, “:”, after the derived class identifier and then specifying the base class name. Note: C# supports single class inheritance only. Therefore, you can specify only one base class to inherit from.
Use the double colon operator (::) to qualify a C++ member function, a top level function, or a variable with global scope with: An overloaded name (same name used with different argument types) An ambiguous name (same name used in different classes)
It's called an initialization list. It initializes members before the body of the constructor executes.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With