clock: passes tests, iteration 1 (?)
This commit is contained in:
parent
eb066800db
commit
e9c27cd864
2 changed files with 106 additions and 0 deletions
35
cpp/clock/clock.h
Normal file
35
cpp/clock/clock.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#define EXERCISM_RUN_ALL_TESTS
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace date_independent {
|
||||
|
||||
typedef long total_t;
|
||||
typedef short hours_t;
|
||||
typedef short minutes_t;
|
||||
|
||||
|
||||
class clock
|
||||
{
|
||||
total_t total_minutes_;
|
||||
|
||||
public:
|
||||
|
||||
clock(hours_t hours = 0, minutes_t minutes = 0);
|
||||
clock(const clock&) = default;
|
||||
clock &operator=(const clock&) = default;
|
||||
|
||||
bool operator==(const clock&) const;
|
||||
bool operator!=(const clock&) const;
|
||||
|
||||
static clock at(hours_t hours, minutes_t minutes = 0);
|
||||
|
||||
clock plus(minutes_t minutes) const;
|
||||
clock minus(minutes_t minutes) const;
|
||||
|
||||
operator std::string() const;
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue