0

I have three child classes which 2 of them work and the last one has the "not a base or memeber error" can anyone tell what went wrong? please see the last file at the bottom

# include <iostream>
# include <string>

using namespace std;

	class Employee
	{
	public:
		Employee();
		Employee(int, string,string, string);
		void setID(int);
		void setLastName(string);
		void setFirstName(string);
		void setPhone(string);
		int getID();
		string getLastName();
		string getFirstName();
		string getPhone();
		void output();

	private:
		int id;
		string lastName;
		string firstName;
		string phone;

	};



# include "Employee.h"



	Employee::Employee(): id(0), lastName("no name set"), firstName("no name set"), phone("no phone set")
	{

	}

	Employee::Employee(int inID, string inLN, string inFN, string inPhone): id(inID), lastName(inLN), firstName(inFN), phone(inPhone)
	{

	}

	void Employee::setID(int inID)
	{
		id = inID;
	}

	void Employee::setLastName(string inLN)
	{
		lastName = inLN;
	}

	void Employee::setFirstName(string inFN)
	{
		firstName= inFN;
	}

	void Employee::setPhone(string inPhone)
	{
		phone= inPhone;
	}

	int Employee::getID()
	{
		return id;
	}

	string Employee::getLastName()
	{
		return lastName;
	}

	string Employee::getFirstName()
	{
		return firstName;
	}
	
	string Employee::getPhone()
	{
		return phone;
	}

void Employee::output()
	{
		cout<<id<<" "<<lastName<<" "<<firstName<<" "<<phone;
	}




#include "Employee.h"

class Mailman
{

	public:
	Mailman();
	Mailman(int,string,string,string,double);

	private:
	double hourlyWage;
};

-----------------------------------mail.cpp file below is the one got error------------
#include "Mailman.h"

Mailman::Mailman()
{
}


Mailman::Mailman(int inID, string inLN, string inFN, string inPhone, double inWage):Employee(inID,inLN,inFN,inPhone), hourlyWage(inWage)
{
}
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by dougy83
0

You have to declare the Mailman class as derived from Employee class, as the error states.

So in Mailman.h, instead of

class Mailman {

use

class Mailman : Employee {
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.