Question: C + + Step 2 : Implement Member Functions Add four member functions to the Date class: getDay ( ) , getMonth (

C++\\Step 2: Implement Member Functions
Add four member functions to the Date class: getDay(), getMonth(), getYear(), and set(int d, int m, int y). Ensure they are declared as public.Date(int m, int d, int y)//another constructor with parameters{ month = m; day = d; year = y;}int getDay(){ return day;}int getMonth(){ return month;} int getYear(){return (year);
}
//assigns all values to private data members
void set(int m, int d, int y){
month = m;
day = d;
year = y;
}
private:
int month;
int day;
int year;
};
Date yesterday(4,18,2022); //call constructor with singleparameterDate tomorrow;tomorrow.set(4,20,2022); // sets 2nd variable's membersDate *afterTomorrow = new Date(4,22,2022);cout yesterday.getMonth()"/" yesterday.getDay()"/" yesterday.getYear() endl;cout today.getMonth()"/" today.getDay()"/"
C + + \ \ Step 2 : Implement Member Functions Add

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!