Question
Consider the definition of the class dateType given in Chapter 11. Write the statement that includes a friend function named before in the class dateType
Consider the definition of the class dateType given in Chapter 11.
Write the statement that includes a friend function named before in the class dateType that takes as parameters two objects of type dateType and returns true if the date represented by the first object comes before the date represented by the second object; otherwise, the function returns false.
Write the definition of the function you defined in part a.
class dateType
{
public: void setDate(int month, int day, int year);
//Function to set the date.
//The member variables dMonth, dDay, and dYear are set
//according to the parameters.
//Postcondition: dMonth = month; dDay = day;
// dYear = year int getDay() const;
//Function to return the day.
//Postcondition: The value of dDay is returned. int getMonth() const;
//Function to return the month.
//Postcondition: The value of dMonth is returned. int getYear() const;
//Function to return the year. //Postcondition: The value of void printDate() const;
//Function to output the datedYear is returned.in the form mm-dd-yyyy. dateType(int month = 1, int day =1, int year = 1900);
//Constructor to set the date
//The member variables dMonth, dDay, and dYear are set
//according to the parameters.
//Postcondition: dMonth = month; dDay = day; dYear = year; //If no values are specified, the default values are used to initialize the member variables.
private: int dMonth;
//variable to store the month
int dDay;
//variable to store the day
int dYear;
//variable to store the year
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started