-
Notifications
You must be signed in to change notification settings - Fork 33
/
date.h
71 lines (53 loc) · 2.09 KB
/
date.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//*****************************************************************************************************
// Date class header file
//
// This header file defines the private and public members and methods of the Date class and
// defines the inline functions (getters and setters).
//
//*****************************************************************************************************
#ifndef DATE_H
#define DATE_H
//*****************************************************************************************************
class Date {
private: // private can only be accessed within the class
int day;
int month;
int year;
public: // public can be accessed within and outside the class
Date(); // constructor
~Date(); // destructor
int getDay() const;
void setDay(const int &d);
int getMonth() const;
void setMonth(const int &m);
int getYear() const;
void setYear(const int &y);
void inputDate();
void displayDate();
};
//*****************************************************************************************************
inline int Date::getDay() const { // inline is a keyword for simple methods
return day;
}
//*****************************************************************************************************
inline void Date::setDay(const int &d) {
day = d;
}
//*****************************************************************************************************
inline int Date::getYear() const {
return year;
}
//*****************************************************************************************************
inline void Date::setYear(const int &y) {
year = y;
}
//*****************************************************************************************************
inline int Date::getMonth() const {
return month;
}
//*****************************************************************************************************
inline void Date::setMonth(const int &m) {
month = m;
}
//*****************************************************************************************************
#endif