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
  • 2,030
  • 6
  • 30
  • 45

3 Answers3

10

Constructor Initialization list


Prasoon Saurav
  • 91,295
  • 49
  • 239
  • 345
6

It's a constructor initialization list

Motti
  • 110,860
  • 49
  • 189
  • 262
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
  • 98,941
  • 38
  • 226
  • 299