Question: The class A is responsible for managing a single int (not an array) on the heap. Write a copy constructor that does a deep copy

The class A is responsible for managing a single int (not an array) on the heap. Write a copy constructor that does a deep copy of an A object. You need to accept an A& as parameter, get the value of that object's myNumber and make your own int on the heap that contains that value Hints One way to start is by just allocating a new int in the copy constructor and always giving it the value 10 (or something else arbitrary), It won't pass the tests, but you can use that to verity that the copied object actually owns its own memory (10 won't get wiped out by changing the original). other.myNumber is a pointer to an int. If you want the value of other's myNumber you need to do "other.myNumber Code #1nclude
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
