#include <iostream>
#include <iomanip>
using namespace std;
class date
{
public:
date (int=7, int=4,int=2012);
void setdate(int, int, int);
void showdate();
private:
int month;
int day;
int year;
};
void date::date(int mm,int dd,int yyyy)
{
month=mm;
day=dd;
year=yyyy;
};
void date::setdate(int mm, int dd, int yyyy)
{
cout<< "the date is ";
cout<<setfill('O')
<<setw(2)<<month<<'/'
<<setw(2)<<day<<'/'
<<setw(2)<<year%100;
// extract the last 2 year digits
cout<<endl;
return;
}
int main()
{
date a,b,c (4,1,2000);
b.setdate(12,25,2009);
a.showdate();
b.showdate();
c.showdate();
return 0;
}
when write this in visual studio, its says the void in "void date::date(int mm,int dd,int yyyy)" is "return type may not be specified on a constructor." help i dont know what that means, and im a major newb at programming.
This is a completely different error. This is a linker error. That means your code compiled fine. It's complaining about not being able to find the main function.