In the following code,
what’s the meaning of :next(next_par),info(info_par)?
struct list_node : public memory::SqlAlloc
{
list_node *next;
void *info;
list_node(void *info_par,list_node *next_par)
:next(next_par),info(info_par) /* what's the meaning of :next(next_par),info(info_par)?*/
{}
list_node()
{
info= 0;
next= this;
}
};
looks like it wants to assign info_par to info for info(info_par), and assign next_par to next for next(next_par). But I didn’t see the definition of next(), info().
:next(next_par),info(info_par)is an initialization list for member variables. Instead of having:EDIT: Just as a note, initialization lists can be important if you have member object variables that need to be constructed with a non-default constructor.