Solved

If Obj1 and Obj2 Are Both Objects of a Class

Question 28

Multiple Choice

If obj1 and obj2 are both objects of a class that uses dynamic memory allocation, but the class does not have an assignment operator, what happens if you execute the following code?
Obj1=obj2;


A) A syntax error occurs, you can not assign one object to another object without the = operator
B) A run-time error occurs, because the C++ system does not know how to do the assignment.
C) The pointers) to the dynamically declared memory in obj2 are copied to the corresponding pointers in obj1.
D) There is a complete and independent copy of all the dynamic memory from obj2 to obj1

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions