I'm mocking a C++ class which has 2 overloaded functions using Google Mock and VS2010:
#include "stdafx.h"
#include "gmock/gmock.h"
#include "A.h"
class MockA : public A
{
public:
// ...
MOCK_METHOD3(myFunc, void(const int id, const int errorCode, const CString errorMsg));
MOCK_METHOD1(myFunc, void(const CString errorMsg));
// ...
};
Each time I compile I get the following warning twice:
1>c:\dev\my_project\tests\mocka.h(83): warning C4373: 'MockA::myFunc': virtual function overrides 'A::myFunc', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
1> c:\dev\my_project\my_project\include\a.h(107) : see declaration of 'A::myFunc'
Any idea why?
Is this correct behavior?
How can I avoid this?
A
's method you're overriding isconst
. – Lysimachus