Question: Please make the code based on C++, and add descriptions for each code. Given the following code: Write a client to produce the following output:

Please make the code based on C++, and add descriptions for eachcode. Given the following code: Write a client to produce the followingoutput: 00 1 10 2 20 3 30 4 40 5 506 60 7 70 8 80 9 90 copyfrom is called Printingthe new copied array 00 1 10 2 20 3 30 440Please make the code based on C++, and add descriptions for each code.

Given the following code: Write a client to produce the following output: 00 1 10 2 20 3 30 4 40 5 50 6 60 7 70 8 80 9 90 copyfrom is called Printing the new copied array 00 1 10 2 20 3 30 440 5 50 6 60 7 70 8 80 9.90 Store - invalid index: 11 ValueAt - invalid index: 11 Initialization Copy constructor is called Pass by copy Copy constructor is called Return by copy Copy constructor is called I/dynamic9.h class pynancay public DynArray( in int arrsize ) Constructor Y PRE arsize is assigned POST: TIE SIZE = 1.88 enough teary THEN Array 0 size site is created with lealents ELSE Toressages DynArray( const DynArray& otherare); copy constructor IT POST Ithis DynArray is a deep copy of other It is splicitly called for inalization DynArray Destructor IZ POST: Memory fon dynamic array deallocated! int ValueAt (in Mint 1 ) const; PRE! 15 assigned POSTE LE BRI size of this chay THEN FETVAL 1 Value of array element at index ELSE erron message. void Store PRE POS in int val, int 1 DI val and are assigned 19 @ include DynArray: :DynArray(10 Yint arrSize ) 1/ Constructor IL PREO arrsize is assigned H/POST: If arrsize >= 1 && enough memory THEN Acray of size arrsize is created with elements B ELSE error message. { all int i; If ( arrSize = size ) { std::cerr = size ) { std::cerr "valuest - invalid index : - 1 // Creates a deep copy of otherine. 1 POST: Array pointed to by arrentry deallocated && IR room on free store // THEN new array is created on free store && arr - Its base address && size == otherArr.size && arr[e.size-1) == otherarr[e..size-1] ELSE halts with error message. int 1; delete() arr; I delete current array size = otherArr.size; are = new int [size]; // allocate new array for (i = 0; i using namespace std

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!