Hey everyone. I have a class that I have split up into a .h file with the function declarations and a .cpp file that has the actual definitions. But what is the right thing to do when I have a function that was originally like:
1 2 3
void myFunc(int a, int b = 1, int c = 1){
//Do some stuff
}
Where do I put the default values, in the .h or the .cpp? I can see why it could go either way. The .h is the thing that tells the other places that use myFunc that it can be called with 1, 2, or 3 arguments, so it seems like it would need the default ones, but on the other hand, the .cpp is the one that is normally more thorough and has the extra information.
So is it like:
.h:
void myFunc(int a, int b = 1, int c = 1);
.cpp:
1 2 3
void myFunc(int a, int b, int c){
//Do stuff
}
or,
.h:
void myFunc(int a, int b, int c);
.cpp:
1 2 3
void myFunc(int a, int b = 1, int c = 1){
//Do stuff
}