/*
* Global Tech's employee system
*/
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
#include "Person.h"
int main(){
Person employee("Sue" , "Jones");
cout << "Employee Info " << employee.getFirstName() << " " << employee.getLastName() << endl;
return 0;
}
/*
* Person Class Definition
*/
#include <string>
using std::string;
class Person{
public:
Person(const string &, const string &);
void setFirstName(const string &);
void setLastName(const string &);
string getFirstName() const;
string getLastName() const;
void print() const;
private:
string firstName;
string lastName;
};
/*
* Class for person
*/
#include<iostream>
using namespace std;
#include<string>
using std::string;
#include "Person.h"//person class definition
/**
* Constructor
*/
Person::Person(const string &first, const string &last) : firstName( first ), lastName( last )
{
setFirstName(first);
setLastName(last);
}
//set First Name
void Person::setFirstName(const string &first){
firstName = first;
}
//set last name
void Person::setLastName(const string &last){
lastName = last;
}
//return first name
string Person::getFirstName() const{
return firstName;
}
//return last name
string Person::getLastName() const{
return lastName;
}
//print Person object
void Person::print() const{
cout << "Person: " << firstName << ' ' << lastName;
}
/*
* header file for Employee
*/
#include <string>
using std::string;
#include "Person.h"
class Employee : public Person{
public:
Employee(int = 000000000);
void setEmployeeID( int );
int getEmployeeID();
void print();
private:
int employeeID;
};
*
* Class Employee member function definition
*/
#include <iostream>
using namespace std;
#include "Employee.h"
/**
* Constructor
*/
Employee::Employee( int eID) : Person(first , last){
setEmployeeID( eID );
}
void Employee::setEmployeeID( int eID){
employeeID = eID;
}
int Employee::getEmployeeID(){
return employeeID;
}
void Employee::print(){
cout << "Employee" << endl;
Person::print();
cout << "\nEmployee ID: " << getEmployeeID();
}
When I compile this I get
[TEX]
Employee.cpp: In constructor 'Employee::Employee(int)':
Employee.cpp:20: error: 'first' was not declared in this scope
Employee.cpp:20: error: 'last' was not declared in this scope
[/TEX]
I cant figure out why it doesnt recognize first and last. Any ideas?