Lets suppose I have the following example struct with a constructor
struct CAddition {
int x;
int y;
int c;
int result() {
return x + y;
}
CAddition();
~CAddition();
};
CAddition::CAddition()
:x(0)
,y(0)
{
c = result();
}
Now if want to initialize c
in the above way it works, but what if I want to initialize my c in within the initialization list something like
, c(result())
it shows a correct result somehow, but is it a correct syntax ? can I face some problems?