Question
C++: Consider the definition of the class dateType given in Chapter 11. a) Write the statement that includes a friend function named before in the
C++: Consider the definition of the class dateType given in Chapter 11.
a) 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.
b) Write the definition of the function you defined in part a.
Here is the class that is given:
class dateType { public: void setDate(int month, int day, int year); int getDay() const; int getMonth() const; int getYear() const; void printDate() const; dateType(int month = 1, int day = 1, int year = 1900);
private: int dMonth; int dDay; int dYear; };
I am not good with friend functions so any help you could offer would be much apperciated.
Thank you in advance
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