Help with this class please :(

Started by
1 comment, last by ThomasSauder 21 years, 6 months ago
Error: Compiling... employee.cpp c:\documents and settings\tj\my documents\sams c++ lessons\employee.cpp(4) : error C2447: missing function header (old-style formal list?) Error executing cl.exe. employee.obj - 1 error(s), 0 warning(s) employee.hpp: #include <iostream> class Employee { public: Employee (int iage, int iYearsOfService, int iSalary); ~Employee(); int GetAge() const { return age; }; void SetAge(int a) { age = a; }; int GetYears() const { return YearsOfService; }; void SetYears(int y) { YearsOfService = y; }; unsigned int GetSalary() const { return Salary; }; void SetSalary(int s) { Salary = s; }; private: int age; int YearsOfService; int Salary; }; employee.cpp: #include "employee.hpp" Employee::Employee (int iage, int iYearsOfService, int iSalary); { age = iage; YearsOfService = iYearsOfService; Salary = iSalary; } Employee::~Employee() { } int main() { Employee Thomas(17, 2, 60000); Thomas.SetAge(17); std::cout << "Thomas is " << Thomas.GetAge() << " years old" << std::endl; Thomas.SetYears(2); std::cout << "Thomas'' years of service is " << Thomas.GetYears() << "\n"; Thomas.SetSalary(60000); std::cout << "Thomas makes " << Thomas.GetSalary() << " per year\n"; Employee Jude(14, 1, 40000); Jude.SetAge(14); std::cout << "Jude is " << Jude.GetAge() << " years old\n"; Jude.SetYears(1); std::cout << "Judes years of service is " << Jude.GetYears() << "\n"; Jude.SetSalary(40000); std::cout << "Jude makes " << Jude.GetSalary() << " per year\n"; return 0; } I thank you in advnace... I''ve been having no luck finding out what is wrong. Thanks!!
Advertisement
Remove the semicolon on line 3 of emplyee.cpp (the Employee constructor)
Ahhhhhhhhhhh
Ok, I know most things about constructors now lol...
Thank you.

Can''t believe I didn''t see that

This topic is closed to new replies.

Advertisement