Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What the heck is this C++ syntax called? [duplicate]

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.

like image 658
Dany Joumaa Avatar asked Jan 16 '11 14:01

Dany Joumaa


3 Answers

Constructor Initialization list


like image 121
Prasoon Saurav Avatar answered Nov 01 '22 04:11

Prasoon Saurav


It's a constructor initialization list

like image 37
Motti Avatar answered Nov 01 '22 06:11

Motti


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.

like image 2
Ferruccio Avatar answered Nov 01 '22 05:11

Ferruccio