2018-06-08 18:25:21 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-06-09 11:13:00 +00:00
|
|
|
#include <QDate>
|
|
|
|
|
2018-06-08 18:25:21 +00:00
|
|
|
class Age
|
|
|
|
{
|
2018-06-09 11:13:00 +00:00
|
|
|
private:
|
2019-10-05 14:14:45 +00:00
|
|
|
unsigned int m_years = 0;
|
|
|
|
unsigned int m_months = 0;
|
2018-06-09 11:13:00 +00:00
|
|
|
|
|
|
|
public:
|
2019-10-05 14:14:45 +00:00
|
|
|
Age() = default;
|
|
|
|
Age(unsigned int years, unsigned int months);
|
|
|
|
Age(const QDate& birth, const QDate& reference);
|
2018-06-09 11:13:00 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
bool operator<(const Age& cmp) const;
|
2018-06-13 19:14:36 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
unsigned int years() const;
|
|
|
|
unsigned int months() const;
|
2018-06-14 17:52:19 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
std::string toString() const;
|
2018-06-08 18:25:21 +00:00
|
|
|
};
|