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
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
electricSpot
,handicapSpot
andlargeSpot
are all parking spots. Why not to create a super class calledParkingSpot
that hasnumber_of_free_slots
andfee
andis_spot_free
method ?Then, in
ParkingOperations
, have a vector ofParkingSpots
You can consider having a factory class to create instances of these concrete parking types