Never been great with classes

So I have an assigment where I need to create a class that stores 3 strings and an int for 3 employee data sets and then spits it all back out.

The instructor gave is weird instructions of the creation of the constuctors though


The class should have the following constructors:

• A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name, employee’s ID number, department, and position.
• A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name and ID number. The department and position fields should be assigned an empty string (“ “);
• A default constructor that assigns empty strings (“ “) to the name, department, and position member variables, and 0 to the idNumber member variable.

I get the point of the first and last one, the first being the assign everything to its proper place and the second to reset everyhting for the next employee you have to enter... but I don't get the partial part of the middle one....


Heres my Employee.h:
#pragma once
#include <iostream>
#include <string>

using namespace std;

class Employee
{
private:
string name;
int idNumber;
string department;
string position;
public:
Employee()
{
name = " ";
idNumber = 0;
department = " ";
position = " ";
}
Employee (string eName, int eId, string eDepartment, string ePosition)
{
name = eName;
idNumber = eId;
department = eDepartment;
position = ePosition;
}

string getName () const
{
return name;
}

int getId () const
{
return idNumber;
}

string getDepartment () const
{
return department;
}

string getPosition () const
{
return position;
}
};


And heres my int Main:

#include "Employee.h"

using namespace std;



int _tmain(int argc, _TCHAR* argv[])
{
Employee emp1("Susan Meyers", 47899, "Accounting", "Vice President");
Employee emp2("Mark Jones", 39119, "IT", "Programmer");
Employee emp3("Joy Rogers", 81774, "Manufacturing", "Engineer");


cout << "Name ID Number Department Poistion" << endl;
cout << emp1.getName() << " " << emp1.getId() << " " << emp1.getDepartment() << " " << emp1.getPosition() << endl;
cout << emp2.getName() << " " << emp2.getId() << " " << emp2.getDepartment() << " " << emp2.getPosition() << endl;
cout << emp3.getName() << " " << emp3.getId() << " " << emp3.getDepartment() << " " << emp3.getPosition() << endl;
return 0;
}



and heres another thing the compiler included when I added the class.. its called Employee.cpp and its where the error I get points to

#include "StdAfx.h"
#include "Employee.h"


Employee::Employee(void)
{
}


Employee::~Employee(void) <---- supposed error right here.
{
}

Please help!
You don't declare a destructor in the class definition. You can't define functions for a class that aren't part of the class.
............ HOLY CRAP IT WORKED!!!
Topic archived. No new replies allowed.