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 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
Define a function printfeetinchshort, with int parameters numfeet and numinches, that prints using ' and " shorthand. ex: printfeetinchshort(5, 8) prints: 5' 8"
Answers: 1
question
Computers and Technology, 23.06.2019 00:20
Ihave been given the number of guns per 100, and the total firearm-related deaths per 100,000. i have to find the actual number of guns per country and actual number of gun-related deaths. if somebody could show me how to do 1 question, i can finish the rest, i am just confused. tia
Answers: 3
question
Computers and Technology, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
You know the right answer?
C++ Consider the definition of the class dateType below:
a. Write the statement that includes...
Questions
question
Mathematics, 04.02.2020 10:01
question
Mathematics, 04.02.2020 10:01
Questions on the website: 13722360