写代码对我来说很乏味
class date {
private:
int day, year, month;
int comp(const date & Other) const;
public:
date(int D, int Y, int M) : day (D), year (Y), month (M) {}
friend bool operator==(const date & L, const date & R) { return L.comp(R) == 0 ; }
friend bool operator!=(const date & L, const date & R) { return L.comp(R) != 0 ; }
friend bool operator> (const date & L, const date & R) { return L.comp(R) > 0 …Run Code Online (Sandbox Code Playgroud)