diff options
Diffstat (limited to 'lab 1/src/counter.cpp')
-rw-r--r-- | lab 1/src/counter.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lab 1/src/counter.cpp b/lab 1/src/counter.cpp new file mode 100644 index 0000000..2af38a8 --- /dev/null +++ b/lab 1/src/counter.cpp @@ -0,0 +1,20 @@ +#include "../include/counter.hpp" + +Counter::Counter() : count(0) {} + +void Counter::increment() { + count++; +} + +void Counter::reset() { + count = 0; +} + +int Counter::get_count() const { + return count; +} + + +std::ostream& operator<<(std::ostream& out, const Counter& c) { + return out << c.count; +} |