Mahmoud-Ismail98 / parking-lot-system-object-oriented-cpp-project

1 stars 0 forks source link

Parking Opeations is coupled with parking slots types #2

Open afesheir opened 6 months ago

afesheir commented 6 months ago

electricSpot, handicapSpot and largeSpot are all parking spots. Why not to create a super class called ParkingSpot that has number_of_free_slots and fee and is_spot_free method ?

Then, in ParkingOperations, have a vector of ParkingSpots You can consider having a factory class to create instances of these concrete parking types

afesheir commented 6 months ago

This will also reduce the multiple inheritance you have, like in SpotBook, that inherits from all parking spot types, will now be only inheriting from ParkingSpot