subject

C++ Consider the definition of the class dateType below:
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.

class dateType

{

public:

void setDate(int, int, int);

void setMonth(int);

void setDay(int);

void setYear(int);

void print() const;

int numberOfDaysPassed();

int numberOfDaysLeft();

void incrementDate(int nDays);

int getMonth() const;

int getDay() const;

int getYear() const;

int getDaysInMonth();

bool isLeapYear();

dateType(int month, int day, int year);

dateType();

private:

int dMonth;

int dDay;

int dYear;

};

a. In a class, why do you include the function that overloads the stream insertion operator, <<, as a friend function?

b. In a class, why do you include the function that overloads the stream extraction operator, >>, as a friend function?

If you define your own exception class, what is typically included in that class?

Suppose the exception class myException is defined as follows:
class myException
{
public:
myException()
{
message = "myException thrown!";
cout << "Immediate attention required!"
<< endl;
}
myException(string msg)
{
message = msg;
cout << "Attention required!" << endl;
}
string what()
{
return message;
}
private:
string message;
}
Suppose that in a user program, the catch block has the following form:
catch (myException mE)
{
cout << mE. what() << endl;
}
What output will be produced if the exception is thrown with the default constructor?
Also, what output will be produced if the exception is thrown with the
constructor with parameters with the following actual parameter?
"May Day, May Day"

Name three exception-handling techniques.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:40
You are working with a professional edition organization. they wish to install the expense tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. if the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install expense tracker?
Answers: 1
question
Computers and Technology, 22.06.2019 17:30
Rachel completed typing an official document with a word processing program. she wants to make sure that her document has no typographical errors. she also wants all headings to have the same font. which features in a word processing program should she use? rachel should use the feature in a word processing program to find typographical errors. she should apply to have uniform headings.
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
What is outfitting a workplace with video in a technology
Answers: 2
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
You know the right answer?
C++ Consider the definition of the class dateType below:
a. Write the statement that includes...
Questions
question
Mathematics, 27.09.2019 19:00
Questions on the website: 13722363