1
0

mytime3.h 591 B

12345678910111213141516171819202122232425
  1. // mytime3.h -- Time class with friends
  2. #ifndef MYTIME3_H_
  3. #define MYTIME3_H_
  4. #include <iostream>
  5. class Time
  6. {
  7. private:
  8. int hours;
  9. int minutes;
  10. public:
  11. Time();
  12. Time(int h, int m = 0);
  13. void AddMin(int m);
  14. void AddHr(int h);
  15. void Reset(int h = 0, int m = 0);
  16. Time operator+(const Time & t) const;
  17. Time operator-(const Time & t) const;
  18. Time operator*(double n) const;
  19. friend Time operator*(double m, const Time & t)
  20. { return t * m; } // inline definition
  21. friend std::ostream & operator<<(std::ostream & os, const Time & t);
  22. };
  23. #endif