design-patterns/creational/abstract_factory/AbstractProductB.py
2020-09-29 22:05:56 +02:00

28 lines
819 B
Python

from abc import ABC, abstractmethod
from creational.abstract_factory.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