design-patterns/structural/composite/leaf.py
2020-09-20 14:42:00 +02:00

14 lines
358 B
Python

from component import Component
class Leaf(Component):
"""
The Leaf class represents the end objects of a composition. A leaf can't
have any children.
Usually, it's the Leaf objects that do the actual work, whereas Composite
objects only delegate to their sub-components.
"""
def operation(self) -> str:
return "Leaf"