O
Onikz
Код:
#include "stdafx.h"
#include "iostream.h"
class Employee {
public:
Employee(int iAge,int iYear,int iSalary);
~Employee();
int GetAge() const {return Age;}
int GetYearOfService() const {return YearOfService;}
int GetSalary() const {return Salary;}
void AddAge(int x) {Age=Age+x;}
void AddYearOfService(int x) {YearOfService=YearOfService+x;}
void AddSalary(int x) {Salary=Salary+x;}
void SetAge(int x) {Age=x;}
void SetYearOfService(int x) {YearOfService=x;}
void SetSalary(int x) {Salary=x;}
private:
int Age;
int YearOfService;
int Salary;
};
Employee::Employee(int iAge,int iYear,int iSalary) {
Age=iAge;
YearOfService=iYear;
Salary=iSalary;
}
Employee::~Employee() {}
int main(){
int d;
Employee Man(18,1,9000);
cout << "One Year passed..." <<endl;
Man.AddYearOfService(1);
Man.AddAge(1);
Man.AddSalary(3000);
printf("YearOfService is %n",Man.GetYearOfService);
printf("Age is %n",Man.GetAge);
printf("Salary is %n",Man.GetSalary);
cin >> d;
return 0;
}
Unhandled exception in 21day.exe: 0xC0000005: Access Violation.
что здесь нетак???