summaryrefslogtreecommitdiff
path: root/7p42.cpp
blob: 6f71c6a919c732ac39006e18766dd85ac473a358 (plain)
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
#include <iostream>

/*
 *
 * 7.40
 *
 *
 */

class Date {
public:
	Date(time_t et, time_t et_c): epochtime(et), epochcompare(et_c) {}
	Date(): Date(0, 0) { std::cout << "delegated\n"; }
	Date(time_t et): Date(et, 0) { std::cout << "delegated\n"; }
	std::ostream& printepoch(std::ostream& pecout) {
		pecout << epochtime;
		return pecout;
	}
	time_t getepoch() { return epochtime; }
	time_t getcompare() { return epochcompare; }
	std::string& getformatted() {
		formatted = "TEST"; // Just an example, we format the time here.
		return formatted;
	}
	
private:
	time_t epochtime;
	time_t epochcompare;
	std::string formatted;
};

int main () {

	Date d1;
	Date d2(342342423);
	d1.printepoch(std::cout) << std::endl;
	d2.printepoch(std::cout) << std::endl;
	std::cout << d1.getepoch() << std::endl;
	std::cout << d1.getformatted() << std::endl;
	return 0;
}