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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.