Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of colon after class name in c++

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?

like image 607
DesirePRG Avatar asked Nov 11 '13 04:11

DesirePRG


People also ask

What is the use of colon in C?

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).

What is colon after class name C#?

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.

What does colon mean in C++ class?

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)

What does colon mean in constructor?

It's called an initialization list. It initializes members before the body of the constructor executes.


1 Answers

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.

like image 56
paddy Avatar answered Sep 22 '22 17:09

paddy