6

Possible Duplicate:
What is this weird colon-member syntax in the constructor?

I see it everywhere in constructors in Qt applications, but I don't know what it's called. I'm trying to find docs about it.

Browser::Browser(QTextBrowser& textBrowser, QObject* parent /*= 0*/)
: // <- What
m_textBrowser(textBrowser), // <- is
QObject(parent) // <- this stuff?
{
}

I apologize for my newbness.

Community
  • 1
  • 1
Dany Joumaa
  • 1,990
  • 6
  • 27
  • 43

3 Answers3

10

Constructor Initialization list


Prasoon Saurav
  • 88,492
  • 46
  • 234
  • 343
6

It's a constructor initialization list

Motti
  • 105,704
  • 46
  • 182
  • 255
2

It is a constructor initialization list. In your example, it looks like it's being used to initialize a data member and a base class.

Ferruccio
  • 96,346
  • 38
  • 221
  • 297