Reputation: 29
Suppose that the foo
class does not have an overloaded assignment operator. What happens when an assignment a = b;
is given for two foo
objects?
options are:
Upvotes: 2
Views: 1579
Reputation: 258608
It depends:
A a;
//this is not an assignment, it is equivalent to A b(a);
A b = a; //default copy constructor is called
A c;
//assignment
c = a; //default assignment operator is called
Upvotes: 4