Created
August 12, 2022 11:05
-
-
Save okanyenigun/2a5c88e4e0f1d0dfefef1b428ec55d1b to your computer and use it in GitHub Desktop.
template pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABC, abstractmethod | |
class Ticket(ABC): | |
def method(self): | |
#read plate | |
plate = self.read_plate() | |
#check record | |
record = self.check_record(plate) | |
#decide price | |
price = self.decide_price(record) | |
return price | |
def read_plate(self): | |
return "34 XXX 123" | |
def get_licence(self, plate: str): | |
return 1 | |
@abstractmethod | |
def decide_price(self, record: int): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment