Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The class B is responsible for a an array of ints on the heap. Write a copy constructor that does a deep copy of a

image text in transcribed

The class B is responsible for a an array of ints on the heap. Write a copy constructor that does a deep copy of a B object. Hint: You need to make your own array on the heap and then copy each int over from the other object's array to your array with a loop. Code 1 #include 3 using namespace std; 5 class B t 6 public: 7 B(int numValues, int start) ( size = numvalues ; //allocate an array on heap myArray new intnumValues 10 12 13 14 15 16 //Do not modify anything on or above the line below this 17 /YOUR CODE BELOW 18 19 20 21 /YOUR CODE ABOVE 22 //Do not modify anything on or below the line above this 23 24void print) 25 26 27 28 29 0 public: //variables public for simplicity of testing code in main - don't try this at home 31 32 33i 34 35 int main) for(inti-o: i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

2. Describe how technology can impact intercultural interaction.

Answered: 1 week ago