design-patterns/creational/abstract-factory/AbstractProductB.py
Ruidy 7b0e4a5801
Singleton (#6)
* singleton example

* chore: enforce style guidelines
2020-09-14 21:27:39 +02:00

28 lines
791 B
Python

from abc import ABC, abstractmethod
from AbstractProductA import AbstractProductA
class AbstractProductB(ABC):
"""
Here's the the base interface of another product. All products can interact
with each other, but proper interaction is possible only between products
of the same concrete variant.
"""
@abstractmethod
def useful_function_b(self) -> None:
"""
Product B is able to do its own thing...
"""
pass
@abstractmethod
def another_useful_function_b(self, collaborator: AbstractProductA) -> None:
"""
...but it also can collaborate with the ProductA.
The Abstract Factory makes sure that all products it creates are of the
same variant and thus, compatible.
"""
pass