Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is this? I have never seen this syntax...

Status
Not open for further replies.

bdt

Programmer
Sep 29, 2002
9
US
SeatingChart::SeatingChart (int theNumberOfRows,
int* numberOfSeatsPerRow)
: numberOfRows(theNumberOfRows)

Here is what makes this weird to me. numberOfRows is a variable NOT a function. Why does it have an arguement list? matter-of-factly, I don't understand much about this constructor at all.
 
: numberOfRows(theNumberOfRows) is an initializer (Could have been a list of initializers).

The variable numberOfRows will be set to theNumberOfRows.

numberOfRows may be a variable or a constant member of the class. If it is a const member, this is is the only way to give it a value.

/JOlesen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top