Question: C++ Design a class called Date. The class should store a date in three integers: month, day and year. There should be a default constructor
C++
Design a class called Date. The class should store a date in three integers: month, day and year. There should be a default constructor that sets the member values to 1st of January 2019, and an overloaded constructor that sets the member values to whatever values passed to it. The constructor should not accept negative numbers and would reset them to be 1.
In addition, there should be two member functions in the class, both return string objects but they do it in different ways:
- StandardFormat(); // YYYY-MM-DD Example: 2019-02-07
- StringFormat(); // Month Day, Year Example: Feb 7, 2019
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
