/HOME MY COURSES COMP 3023 ASSESSMENT PRACTICE EXAM Information Question 3 Not yet answered Marked out of 1.00 Read through the following code then answer the questions below: #include
#include using namespace std; class PracticeExam { public: PracticeExam(string grade) : _grade{grade} { cout << " +" << _grade; } ~PracticeExam() { cout << " -" << _grade; } private: friend ostream& operator<<(ostream &out, const PracticeExam &e); string _grade; }; ostream& operator<<(ostream &out, const PracticeExam &e) { return out << ' ' << e._grade; } int main() { cout << "Grades:"; PracticeExam e1{"HD"}; PracticeExam *e2{&e1}; PracticeExam *e3{new PracticeExam{"C"}}; { PracticeExam &e4{*e3}; cout << *e2; PracticeExam e5{"D"}; cout << e4; } delete e3; return 0; } Enter the output of the above code in the box below: /Path: p Question 4 Not yet answered Marked out of 10.00 Briefly explain why the above code produces the output that it does. It may help to briefly explain what is happening for each line of code in the 'main' function. Font family Font size Paragraph 欢迎咨询51作业君