I can't figure out why when I try to declare a function of a derived class in the main part of my program, I get an error saying 'SalariedEmployee' undeclared (first use this function).
Okay, that seems to have helped in allowing me to compile more. Though I'm still getting an error: "[Linker error] undefined reference to `employeessavitch::SalariedEmployee::SalariedEmployee()' "
I'm trying to now use some of the functions in the Employee.h by typing something like define.set_name("John Doe"); for set_name.
Is that the correct way to implement these functions? Cause when I try to do so I get an error saying
"void employeessavitch::Employee::set_name(std::string)' is inaccessible"
within context
"employeessavitch::Employee' is not an accessible base of `employeessavitch::SalariedEmployee' "
The problem is that the linker can't find the definitions of the member functions. If you have more source files make sure that you compile and link them all.
I have an include directive for employee.h and salariedemployee.h in int main(). My derived class salariedemployee.h has an include directive for the base class employee.h as well. Both of my .cpp files also have their header files #included.
I am still getting a linker error when trying to compile in main. I have a total of 5 source files. Are there any include directives that I could be missing still?