/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/code-407-113-020/main.py
23 строки
715 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
# Python (хороший пример) from abc import ABC, abstractmethod class NotificationService(ABC): @abstractmethod def send(self, message): pass class EmailNotificationService(NotificationService): def send(self, message): print(f"Sending email: {message}") class SmsNotificationService(NotificationService): def send(self, message): print(f"Sending SMS: {message}") class OrderService: def __init__(self, notifier: NotificationService): self.notifier = notifier # Зависимость от абстракции def place_order(self, order): # Логика оформления заказа self.notifier.send("Order placed!")