blob: 2161f0e666258a5d3d4db2f06aa51a77d350822b (
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
|
#include <iostream>
/*
*
* 7.40
*
*
*/
class Date {
public:
Date() {
epochtime = 11111111; // Just an example. This should "get" the current time.
}
Date(time_t i): epochtime(i) {}
std::ostream& printepoch(std::ostream& pecout) {
pecout << epochtime;
return pecout;
}
time_t getepoch() { return epochtime; }
std::string& getformatted() {
formatted = "TEST"; // Just an example, we format the time here.
return formatted;
}
private:
time_t epochtime;
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;
}
|