Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 06 / Event / Date.h
blob: 8c2f085d38a7a2b5205d8e6282ff84d310ebe17e (plain) (blame)
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
#pragma once

class Date
{
	size_t day;
	size_t month;
	size_t year;

	size_t MAX_DAYS[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

	mutable int dayOfWeek;  //allowing to be changed by constant objects
	mutable bool isModified = true;

	bool isLeapYear() const;
public:
	Date(size_t day, size_t month, size_t year);
	
	size_t getDay() const;
	size_t getMonth() const;
	size_t getYear() const;

	void setDay(size_t);
	void setMonth(size_t);
	void setYear(size_t);

	void print() const;
	void goToNextDay();

	bool areEqual(const Date& other) const;

	int getDayOfWeek(); //cant be const, because of changings dayOfWeek and isModified 
						// can we get around this ??
};