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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -