You have a class called mybag that contains this partial


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)

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: You have a class called mybag that contains this partial
Reference No:- TGS01190611

Expected delivery within 24 Hours