Hello..
Can I call function somefunc this way (from constructor):
Thanks againCode:class someclass { public: someclass(int num, bool yes) : num_m(num), somefunc(num, yes) { } int num_m; void somefunc(int num, bool yes) { } };
Hello..
Can I call function somefunc this way (from constructor):
Thanks againCode:class someclass { public: someclass(int num, bool yes) : num_m(num), somefunc(num, yes) { } int num_m; void somefunc(int num, bool yes) { } };
Have you even tried to compile?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
you put a function call in the initializer list? that doesn't make any sense; did you mean this? the answer is generally yes (there are some obscure exceptions).
Code:class someclass { public: someclass(int num, bool yes) : num_m(num) { somefunc(num, yes); } int num_m; void somefunc(int num, bool yes) { } };
I know this option is possible, but wasnt sure about calling function from initalizer.