Question: C++ Suppose we implement the += operator as shown below: void bag::operator +=(const bag& b) { int I; assert(size() + b.size()
C++
Suppose we implement the += operator as shown below:
void bag::operator +=(const bag& b) {
int I;
assert(size() + b.size() <= CAPACITY);
for (i=0; i data[used] = b.data[i]; used=used+1; } } What will go wrong with b+=b? Provide the correct implementation (do not use the copy function from cstdlib).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
