#include "Date.hpp" const _ptr& compares_dates(const _ptr& a, const _ptr& b) { if (a->getYear() > b->getYear()) return a; else if (a->getYear() < b->getYear()) return b; else { if (a->getMonth() > b->getMonth()) return a; else if (a->getMonth() < b->getMonth()) return b; else { if (a->getDay() > b->getDay()) return a; else return b; } } } void swap_dates(_ptr& a, _ptr& b) { _ptr temp(a); a = b; b = temp; } void exercise_2() { _ptr date1(new Date(9, 07, 2022)); _ptr date2(new Date(10, 07, 2022)); _ptr date3(new Date(11, 07, 2022)); std::cout << *compares_dates(date1, date2) << std::endl; swap_dates(date2, date3); std::cout << *compares_dates(date1, date2) << std::endl; }