// ====================================================== // A general-purpose countdown timer // To use this class, specialize it // and override tick() // // ====================================================== #ifndef timer_H #define timer_H #include class Timer { public: Timer(); void timeoutRequest(int seconds); // template method void tick(); protected: bool isExpired(); private: virtual void doExpired() = 0; int timeToGo; }; #endif