Using Visual Studio 2010 C++ with googlemock. I'm trying to use a mock I created and I'm getting the compiler error on the line:
EmployeeFake employeeStub;
The error is:
1>c:\someclasstests.cpp(22): error C2512: 'MyNamespace::EmployeeFake' : no appropriate
default constructor available
EmployeeFake:
class EmployeeFake: public Employee{
public:
MOCK_CONST_METHOD0(GetSalary,
double());
}
Employee:
class Employee
{
public:
Employee(PensionPlan *pensionPlan, const char * fullName);
virtual ~Employee(void);
virtual double GetSalary() const;
}
I gather that the problem is that the base class doesn't have a default constructor but how should I fix this? Do I need to add a default constructor to my base class? Or do I need to add a constructor to my mock class? Or something else?