Help Me with this code. i JUST installed code::Blocks and am not familiar with the errors , I wanted to know what is going wrong with this?
#include <iostream>
using namespace std;
int f();
class Date{
int d,m,y;
static Date default_date;
public:
void set_default(int dd,int mm,int yy);
Date(int,int,int);
Date& addyear(int);
int show_date(){return d;}
int show_month(){return m;}
int show_year(){return y;}
};
Date::Date(int dd=0,int mm=0,int yy=0)
{
d=dd? dd:default_date.d;
m=mm? mm:default_date.m;
y=yy? yy:default_date.y;
}
Date& Date::addyear(int n)
{
y +=n;
return *this;
}
void Date::set_default(int dd,int mm,int yy)
{
Date::default_date.d=dd;
Date::default_date.m=mm;
Date::default_date.y=yy;
}
int main()
{
Date::set_default(9,7,2000);
Date S(3,7,1991);
cout<<"Date"<<S.show_date()<<"-"<<S.show_month()<<"-"<<S.show_year()<<"\n";
S.addyear(18);
cout<<"Date"<<S.show_date()<<"-"<<S.show_month()<<"-"<<S.show_year();
}