Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #== abstract Ride Factory
- class RideFactoryInterface:
- def getRide(category):pass
- #== concrete Ride Factory
- class Car(RideFactoryInterface):
- @staticmethod
- def getRide(category):
- if category == "premium":
- return CarPremiumRide()
- if category == "delux":
- return CarDeluxRide()
- assert 0, "Couldn't find car " +category
- class Bike(RideFactoryInterface):
- @staticmethod
- def getRide(category):
- if category == "premium":
- return BikePremiumRide()
- if category == "delux":
- return BikeDeluxRide()
- assert 0, "Couldn't find Bike " +category
Add Comment
Please, Sign In to add comment