From c2d59bb8a75c6228a91393b9cf3aedcb4d455218 Mon Sep 17 00:00:00 2001 From: Oskar Date: Sat, 28 Sep 2024 11:18:41 +0200 Subject: more --- 7p40.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 7p40.cpp (limited to '7p40.cpp') diff --git a/7p40.cpp b/7p40.cpp new file mode 100644 index 0000000..2161f0e --- /dev/null +++ b/7p40.cpp @@ -0,0 +1,40 @@ +#include + +/* + * + * 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; +} -- cgit v1.2.3