1

I am having difficulties with understanding operator overloading, in this next example, an = operator is being overloaded twice, why?

ParkingLot& operator=(const ParkingLot& p) {
 if (this != &p) { delete(); copy(p); }
 return *this;}
ParkingLot& operator=(Parkinglot&& p) {
 if (this != &p) { delete(); move(p); }
 return *this;}

I see that these have something to do with copy and move constructor based on the parameters, but what exactly, and why is there a reference next to the ParkingLot as a return type? Thank you in advance!

0 Answers0