Advertisement
adolphuZ

Untitled

Jun 6th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. class CarFactory(ABC):
  2.     @abstractmethod
  3.     def create_car(self):
  4.         pass
  5.  
  6. class ElectricCarFactory(CarFactory):
  7.     def __init__(self, prototype):
  8.         self.prototype = prototype
  9.  
  10.     def create_car(self):
  11.         return self.prototype.clone()
  12.  
  13. class GasolineCarFactory(CarFactory):
  14.     def __init__(self, prototype):
  15.         self.prototype = prototype
  16.  
  17.     def create_car(self):
  18.         return self.prototype.clone()
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement