Help me in understanding the power of OOPS in this famous Parking Lot example. I read this post yesterday trying to figure out perfect lower level design.
ParkingLot - ParkingLot has ParkingSpaces ( List of ParkingSpaces) - exit() - entrance() - Update() - int capacity
ParkingSpace -long id -String type (2 wheeler, 4 wheeler etc) -Vehicle (has Vechicle Reference)
Vehicle (interface- any kind of vehicle (two wheeler, four wheeler) - park() - Unpark() abstract methods - has reference of ParkingLot and ParkingSpace
Car,Truck different kind of vehicles implements Vehicle.
Is there anything am I missing here...is there any design pattern I need to follow here.. How are we achieving polymorphism in this example.