I am trying to make a program that implements a date class. All it does is print the date constructed by the default constructor. However, why are my main functions getting "undefined reference" errors? Also, If i wanted to implement certain rules on the values of month year and day(eg. day cannot be less than 0 or larger than 30) where would that part of the code? My guess is in the class definition in the header file but I am unsure. Any help is greatly appreciated!
#include <iostream>
#include "Date.h"
usingnamespace std;
int main()
{
int x,y,z;
Date MyDate;
cout<<"Welcome to my Date increment program!!"<<endl;
cout<<"Please enter a month number of your date to start:";
cin>>x;
cout<<"Enter the day number of your date:";
cin>>y;
cout<<"Enter year:";
cin>>z;
MyDate.setDate(x,y,z);
MyDate.printDate();
return 0;
}
#ifndef DATE_H
#define DATE_H
class Date {
private:
int month,day,year;
public:
Date();
~Date();
void setDate(int,int,int);
void printDate();
int getMonth();
int getDay();
int getYear();
};
#endif // DATE_H