I encountered some code where one guy has overloaded copy constructor and assignment operator, like this:
Prod(const Prod& src) {
_id = src._id;
_name = src._name;
_group = src._group;
...
}
Prod& operator=(const Prod& src) {
_id = src._id;
_name = src._name;
_group = src._group;
...
}
The thing I find strange is that none of the member variables in the Prod class are pointers. So why is there a need to overload the copy constructor and = operator as above?