Handson Lab after the Midterm Exam
Write a program
so that you can count the number of times a
constructor, copy constructor, destructor, and assignment operator
is invoked for the following code, before and after the function move() is called:
void move( Thing x )
{
Thing y = x;
Thing z[3];
Thing *p = z;
y = z[2];
p = new Thing();
delete p;
}
int main()
{
Thing a;
Thing *b;
move( a );
// how many times at this point
b = new Thing(a);
delete b;
return 0;
}
You will need to include a declaration for the Thing class for the above code to compile.
Submit your source program to jpcvergara@yahoo.com and jpvergara@gmail.com.