How to pass optional arguments to a method in C++? -
how pass optional arguments method in c++ ? code snippet...
here example of passing mode optional parameter
void myfunc(int blah, int mode = 0) {  if(mode == 0)   do_something();  else   do_something_else(); }   you can call myfunc in both ways , both valid
myfunc(10); //mode set default 0 myfunc(10, 1);//mode set 1      
Comments
Post a Comment