Question: Define a c++ class with a public overloaded binary member operator + with a positive integer n of days as parameter, which creates a new
Define a c++ class with a public overloaded binary member operator + with a positive integer n of days as parameter, which creates a new date object as result, which is n days later than the stored date (examples: 2022-12-16 + 3 days should return 2022-12-19 as result, 2022-12-31 + 1 day as return 2023-01-01, 2023-01-27 + 7 days as return 2023-02-03 Note: for simplicity, the value of n should be a maximum of 28 days (4 weeks).
For the implementation of the member operator +, a constant class variable array daysInMonth may be helpful, in which the number of days is stored for each month;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
