c/c++课的作业合集,都是很简单的文件。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
643 B

#include <sstream>
#include "Date.h"
Date::Date(int year, int month, int day) : year(year), month(month), day(day) {}
Date::Date(const Date &date) : year(date.year),month(date.month), day(date.day) {}
int Date::getYear() const {
return year;
}
int Date::getMonth() const {
return month;
}
int Date::getDay() const {
return day;
}
void Date::setDate(int year, int month, int day) {
Date::year = year;
Date::month = month;
Date::day = day;
}
std::string Date::toString() const {
std::stringstream output;
output << year << '-' << month << '-' << day;
return output.str();
}