You have a class called MyBag that contains this partial implementation of the overloaded assignment operator. The first line is missing.
//Missing Line goes here
{
if(this == &source)
return;
else
{
numUsed = source.numUsed;
numAllocated=source.numAllocated;
Item *newarr = new Item[numAllocated];
for(int i = 0; i newarr[i] = source.arr[i];
arr = newarr;
}
}
Which of the following could be used as the missing line of this implementation file to overload the assignment (=) operator for the MyBag class?
A. |
MyBag& MyBag::operator =(const MyBag &source) |
B. |
void operator MyBag=(MyBag::MyBag &source) |
C. |
void MyBag::operator =(const MyBag &this) |
D. |
void MyBag::operator =(const MyBag &source)
|