请哪位达人分析下c++代码的错误。。能解释下更好
程序代码:
#include<iostream> class Employee { public: unsigned int getAge() const; unsigned int getYearsOfService() const; double getSalary() const; void setAge(unsigned int tage); void setYearsOfService(unsigned int tyearsOfService); void setSalary(double tsalary); Employee(unsigned int tage); ~Employee(); private: unsigned int age; unsigned int yearsOfService; double salary; } Employee::Employee(unsigned int tage) { age = tage; } Employee::~Employee(){} unsigned int Employee::getAge() const { return(age); } unsigned int Employee::getYearsOfService() const { return(yearsOfService); } double Employee::getSalary() const { return(salary); } void Employee::setAge(unsigned int tage) { age = tage; } void Employee::setYearsOfService(unsigned int tyearsOfService) { yearsOfService = tyearsOfService; } void Employee::setSalary(double tsalary) { salary = tsalary; } int main() { Employee employee(20); std::cout<< employee.getAge(); return 0; }
请问下这个程 序有哪错误。。谢谢。。
编译器提示:
--------------------Configuration: Cpp3 - Win32 Debug--------------------
Compiling...
Cpp3.cpp
C:\Documents and Settings\negatlov\My Documents\Cpp3.cpp(20) : error C2533: 'Employee::Employee' : constructors not allowed a return type
C:\Documents and Settings\negatlov\My Documents\Cpp3.cpp(52) : error C2264: 'Employee::Employee' : error in function definition or declaration; function not called
Error executing cl.exe.
Cpp3.obj - 2 error(s), 0 warning(s)