diff --git a/mydate.cpp b/mydate.cpp new file mode 100644 index 0000000..4853cf9 --- /dev/null +++ b/mydate.cpp @@ -0,0 +1,20 @@ +#include +#include "mydate.h" + +mydate::mydate(int _year, int _month, int _day) + : year{_year}, month{_month}, day{_day} +{ + std::cout << "创建了日期对象 "; + print(); +} + +mydate::~mydate() +{ + std::cout << "撤销了日期对象 "; + print(); +} + +void mydate::print() +{ + std::cout << year << '-' << month << '-' << day << '\n'; +} \ No newline at end of file