1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef COUNTER_HPP #define COUNTER_HPP #include <ostream> class Counter { public: Counter(); void increment(); void reset(); int get_count() const; friend std::ostream& operator<<(std::ostream& out, const Counter& c); protected: int count; }; #endif