virtual void myFunc(int& a, int& b) {}
I get warnings about unused variables but I do not want to do anything with them in the base class. I want the derived classes to implement them if they want, and to do nothing if they do not implement them. What can I do to stop the warnings other than putting a flag on the compiler ?
Simply don't give them a name:
virtual void myFunc( int&, int& );
Since you don't want to use them you can emit the parameter names.
However, instead of removing them completely it's sometimes more useful to comment them out like this:
virtual void myFunc(int& /* a */ , int& /* b */ )
{
}
This way you can still see what the intent of the parameter was by looking at the commented out name. This is particularly useful if you put the implementation in the header as it will be the only place which mentions the parameter names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With