im trying to create two classes: a Date class and a Time class. The Date class has to have three private data members: day, month and year. The Time class should have two private data members: hour and minute. Each class should have two member functions: a constructor and display.
im lost and my code won't run
class Date {
private:
int month, day, year;
public:
Date(int m, int d, int y){
month = m;
day = d;
year = y;
}
};
#endif
#include<iostream>
#include "Date.h"
Date::
void Date::Display( int m, int d, int y)
{
month = m;
day = 0;
year = y;
cout<<month<<" "<<date<<", "<<year<<endl;
}
#include "Date.h"
#include "Time.h"
int main()
{
Date dt(7,4,1776);
Time tm(12,3);
dt.display();
tm.display();
return 0;
}
declaration of function Display missing in class Date.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
class Date
{
private:
int month, day, year;
public:
void Display(int , int , int); //this was missing
Date(int m, int d, int y){
month = m;
day = d;
year = y;
}
};