Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the output of the following program? #include <iostream.h> class Contain

ID: 3533520 • Letter: W

Question

What is the output of the following program?

#include <iostream.h>

class Container {

public:

int value;

Container( int amount ) { value = amount;

cout << "Value " << value << endl; };

~Container() { cout << " You just killed: " << value << endl; };

};

class ExamQuestion {

public :

Container data;

ExamQuestion(int A) : data(A) { cout << "New Object ";};

ExamQuestion( const ExamQuestion& X ) : data(X.data.value + 10)

{ cout << "Special "; };

};

void TrickyPart(ExamQuestion why){

ExamQuestion PartB = why;

cout << "After PartB ";

}

int main(){

ExamQuestion Answer(1);

cout << "Call TrickyPart ";

TrickyPart(Answer);

cout << "end" << endl;

}

Explanation / Answer

output -

value 1

New Object

Call Tricky Part

value 11

New Object

After PartB

end

You just killed 11

You just killed 1


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote