Search code examples
c++warningscompiler-warningssuppress-warnings

c++ virtual function with arguments getting warnings when unused


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 ?


Solution

  • Simply don't give them a name:

    virtual void myFunc( int&, int& );