EN: The Abstraction defines the interface for the "control" part of the two class hierarchies. It maintains a reference to an object of the Implementation hierarchy and delegates all of the real work to this object. RU: Абстракция устанавливает интерфейс для «управляющей» части дву
| 29 | |
| 30 | |
| 31 | class Abstraction: |
| 32 | """ |
| 33 | EN: The Abstraction defines the interface for the "control" part of the two |
| 34 | class hierarchies. It maintains a reference to an object of the |
| 35 | Implementation hierarchy and delegates all of the real work to this object. |
| 36 | |
| 37 | RU: Абстракция устанавливает интерфейс для «управляющей» части двух иерархий |
| 38 | классов. Она содержит ссылку на объект из иерархии Реализации и делегирует |
| 39 | ему всю настоящую работу. |
| 40 | """ |
| 41 | |
| 42 | def __init__(self, implementation: Implementation) -> None: |
| 43 | self.implementation = implementation |
| 44 | |
| 45 | def operation(self) -> str: |
| 46 | return (f"Abstraction: Base operation with:\n" |
| 47 | f"{self.implementation.operation_implementation()}") |
| 48 | |
| 49 | |
| 50 | class ExtendedAbstraction(Abstraction): |