For the life of me I can't spot any error in this piece of code, i've started a small piece, so I compiled it to check if it was all good. But it comes out with an error
The error isCode:#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
class employee
{
private:
int number;
float salary;
string fname;
string lname;
public:
employee(int num, float sal, string first, string last);
employee();
~employee();
int getnumber();
float getsalary();
string getfname();
string getlname();
void setfname(string newfname);
void setlname(string newlname);
};
employee::employee(int num, float sal, string first, string last)
{
num = 0;
sal = 0.00;
first = "Default";
last = "Default";
}
employee::~employee()
{}
int employee::getnumber()
{
return number;
}
float employee::getsalary()
{
return salary;
}
string employee::getfname()
{
return fname;
}
string employee::getlname()
{
return lname;
}
void employee::setfname(string newfname)
{
fname = newfname;
}
void employee::setlname(string newlname)
{
lname = newlname;
}
void main()
{
employee List[2];
int Number = 0;
float Salary = 0;
string firstName = "Default";
string lastName = "Default";
}
If anyone could hint me towards the solution that'd be great...thanksQuote:
1>------ Build started: Project: Assignment2V1_Correct, Configuration: Debug Win32 ------
1>Compiling...
1>Assignment2_Correct.cpp
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1>Assignment2_Correct.obj : error LNK2019: unresolved external symbol "public: __thiscall employee::employee(void)" (??0employee@@QAE@XZ) referenced in function _main
1>C:\Users\anonymous\Documents\Programming\C++\Ass ignment2V1_Correct\Debug\Assignment2V1_Correct.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\anonymous\Documents\Programming\C++\Assig nment2V1_Correct\Assignment2V1_Correct\Debug\Build Log.htm"
1>Assignment2V1_Correct - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========