Error

Can Anyone please tell me where I went Wrong.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<iostream>
#include<conio.h>
using namespace std;
class date
{
      public:
      int day,month,year;
      public:
             date();
             date(int,int,int);
             date operator ++();
             };
date::date(int a,int b,int c)
{
               day=a;
               month=b;
               year=c;
               }
date date::operator++()
{
     day++;
     month++;
     year++;
     }
int main()
{
    date d(3,4,5);
    date e;
    e=++d();
    cout<<"Day "<<e.day<<" Month "<<e.month<<" Year "<<e.year;
    getch();
}
You went wrong on lines 2 and 3.
Last edited on
What error messages are you getting? Please post them.

Also please explain this line:
e=++d();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
#include<conio.h>
using namespace std;
class date
{
      public:
      int day,month,year;
      public:
             date();
             date(int,int,int);
             date operator ++();
             };
date::date(int a,int b,int c)
{
               day=a;
               month=b;
               year=c;
               }
date date::operator++()
{
     day++;
     month++;
     year++;
     }
int main()
{
    date d(3,4,5);
    ++d;
    cout<<"Day "<<d.day<<" Month "<<d.month<<" Year "<<d.year;
    getch();
}


I got it working Thank you
Topic archived. No new replies allowed.