Question: Using C++ 3. (10 points) The following code defines the overloading assignment operator for bag class with a linked list. What will happen if
Using C++

3. (10 points) The following code defines the overloading assignment operator " for bag class with a linked list. What will happen if we do a self-assignment with this code, e.g., b-b (b is an object of class bag)? If the result is inaccurate, find if anything is missed. void bag: :operatorconst bag& source) node tail_ptr; /I Needed for argument to list_copy list_clear (head_ptr); many_nodes0 list_copy(source.head_ptr, head_ptr, tail_ptr); many_nodes source.many_nodes; Here, many_nodes is a private member in the bag class to record the number of nodes in the list. You can also find both precondition and postcondition of list clear and list_copy in our textbook (page 256)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
