46.4k views
0 votes
Write a copy assignment operator for carcounter that assigns objtocopy.carcount to the new objects's carcount, then returns *this. sample output for the given program:cars counted: 12

1 Answer

1 vote
Answer: int main() { CarCounter frontParkingLot; CarCounter backParkingLot; frontParkingLot.SetCarCount(12); backParkingLot = frontParkingLot; cout << "Cars counted: " << backParkingLot.GetCarCount(); return 0; }
User Dime
by
7.1k points