Question: O0P basics C++ class and C struct P2.1 Given the following date class interface: class date private int nonth; 2 int day; 1-28,29. 30,3t depending

O0P basics C++ class and C struct P2.1 Given the following date class interface: class date private int nonth; 2 int day; 1-28,29. 30,3t depending on month& year int year; 4-digit eg 2017 public: date) Defauln constructor (ivestigale; find what it is used for) Postcondition: the newly declared date object is initialized to 01/01 2000 date(int mn, int dd int yyyy) Postconditiom: the newly declared data objecs is initialized to mmiddiyyyy void setDate(int mm, int dd, int yyyy); vold displayDatevi); Second constructor Postcosdition set the contents of the calling date object to the values passed to the funetion Pusteondition: display the calling date object in mm'ddlyyy format, e.g, 02/222017 Postcondition: display the calling datecobject in the format like: February 22, 2817 compares the two date objects; the calling one the dObj than is passed so the function void displayDatev2); int compareDates (date &dobj) Postcoedition retums-1,0, or l if the calling date object if less tham, equal to, or grealer than dObj, respectively. Your are asked to 1. Implement all six member functions 2. Write a main) function containing C++ code to test all six member functions. Note that for the compareDates function, you must test all three possibilities! Format you program output so make it easily readable language feature included as part of C++ language (C is a subset of C++). Struct is similar to "class" keyword struct in the previous program In this assignment, you are asked to just replace the keyword class by k and keep the rest of the code unchanged. Try to compile and run the program to see if you get the same output. Note that there are differences between class and struct. While all members in a class are private are publc by default when placed in a struct! Another difference is that class supports inheritance while struct does not. Inheritance is a corner stone of OOP, a very important feature because it promotes software reuse We'll discuss inheritonce near the end of the semester by defaultthey
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
