Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having issues resolving these issues: ElasticArray.cpp:186:24: error: no viable overloaded '=' concatArray[i] = rhs._array[i]; // Copy elements from the left-hand array ~~~~~~~~~~~^ ~~~~~~~~~~~~~

I am having issues resolving these issues:

ElasticArray.cpp:186:24: error: no viable overloaded '=' concatArray[i] = rhs._array[i]; // Copy elements from the left-hand array ~~~~~~~~~~~^ ~~~~~~~~~~~~~ ElasticArray.cpp:99:35: note: candidate function not viable: 'this' argument has type 'const ElasticArray', but method is not marked const const ElasticArray& ElasticArray::operator= (const ElasticArray& array) { ^ ElasticArray.cpp:189:38: error: no viable overloaded '=' concatArray[this->_size + i] = rhs._array[i]; // Copy elements from the right-hand array ~~~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~~~~ ElasticArray.cpp:99:35: note: candidate function not viable: 'this' argument has type 'const ElasticArray', but method is not marked const const ElasticArray& ElasticArray::operator= (const ElasticArray& array) {

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here are the instructions:

Create your prototype for the assignment operator now. It is named operator=, it takes a single parameter which should be a constant reference to an ElasticArray, and it returns an ElasticArray by constant reference.

Add an implementation for the assignment operator to your implementation file. Dont forget scope resolution! The implementation should follow the sequence of steps shown in the second figure above, and detailed in the algorithm below.

To assign an ElasticArray source to an ElasticArray destination: 1. de-allocate the array memory owned by the destination object 2. allocate a new array in the destination object that is the same size as the physical size of the source object's array. 3. set the physical and logical size attributes of the destination object to match the source object. 4. copy all values from the source object's logical array into the destination object's logical array. (No need to copy beyond the end of the logical arrays. 

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago

Question

Question Who can establish a Keogh retirement plan?

Answered: 1 week ago