//I have written this program to create student objects and increase their school year I'm getting one error about the showYear function.
#include "stdafx.h"
#include<iostream>
#include<string>
#include<conio.h>
#include<ctime>
using namespace std;
class Student
{
private:
int stuID;
int year;
double gpa;
public:
Student(const int, const int, const double);
void showYear();
Student& operator++();
};
Student::Student(const int i, const int y, const double g)
{
stuID = i;
year = y;
gpa = g;
}
void Student::showYear()
{
cout << year;
}
Student& Student::operator++()
{
++year;
return *this;
}
int main()
{
Student a(111,2,3.50), b(222,1,3.00), c(333,3,2.75);
cout << "Student a is year ";
a.showYear();
cout << endl;
cout << "Student b is year ";
b.showYear();
cout << endl;
cout << "Student c is year ";
c.showYear;
cout << endl;
++a;
++b;
++c;
cout << "Student a is now year ";
a.showYear();
cout << endl;
cout << "Student b is now year ";
b.showYear();
cout << endl;
cout << "Student c is now year ";
c.showYear();
cout << endl;
return 0;
}