Code:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <memory>
using namespace std;
class CFather
{
public:
void DoWork(int val)
{
}
};
class CSon : public CFather
{
public:
void DoWork(int val, int two)
{
}
};
int main(void)
{
CSon* myson = new CSon;
myson->DoWork(12);
delete myson;
}
When I compile the code above, g++ complains:
derived_test.cpp:24: error: no matching function for call to 'CSon:: DoWork(int)'
derived_test.cpp:17: note: candidates are: void CSon:: DoWork(int, int)
I don't get the reason and how to solve this problem, Any advice would be kind, Thanks in advance.