what does ":" do in c++ code?

asilter's Avatar, Join Date: Jul 2007
Newbie Member
i'm trying to read and understand a .cc (c++)file,
i want to know what does ok_flag(false),time_range(false),prefix() do after ":" ?
I did know that ":" was being used for class inheritance but what is ":" for in the bleow code?
Code:
ClassA::ClassA(const char *db) : ok_flag(false),time_range(false),prefix()
{
//.. Constructor statements
}
plz help
thanx.
DaWei's Avatar, Join Date: Dec 2006
Team Leader
It initializes those variables in the class. It's more effective than putting statements inside the constructor.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
As far as I can remember its called initialization block.
asilter's Avatar, Join Date: Jul 2007
Newbie Member
ok,thanks.