Avoid warning 'Unreferenced Formal Parameter'

Posted by bdhar on Stack Overflow See other posts from Stack Overflow or by bdhar
Published on 2010-06-11T06:19:18Z Indexed on 2010/06/11 6:22 UTC
Read the original article Hit count: 250

I have a super class like this:

class Parent
{
public:
    virtual void Function(int param);
};

void Parent::Function(int param)
{
    std::cout << param << std::endl;
}

..and a sub-class like this:

class Child : public Parent
{
public:
    void Function(int param);
};

void Child::Function(int param)
{
    ;//Do nothing
}

When I compile the sub-class .cpp file, I get this error

warning C4100: 'param' : unreferenced formal parameter

As a practise, we used to treat warnings as errors. How to avoid the above warning?

Thanks.

© Stack Overflow or respective owner

Related posts about c++

Related posts about compiler-warnings