// // Created by moon on 9/7/17. // #include <iostream> using namespace std; class Date{ private: int Day,Month,Year; public: Date(int InputDay,int InputMonth,int InputYear):Day(InputDay),Month(InputMonth),Year(InputYear){}; //返回值,+完之后会得到值。&,证明是返回本身。 Date& operator +(int DaysToAdd){ Day+=DaysToAdd; return *this; } void DisplayDate(){ cout<<Day<<"/"<<Month<<"/"<<Year<<endl; } }; int main(){ Date Holiday(25,12,2011); Holiday.DisplayDate(); Date fuck(Holiday); Date sex = Holiday+7; sex.DisplayDate(); }