design-patterns/structural/composite/leaf.py
2020-09-29 22:05:56 +02:00

14 lines
379 B
Python

from structural.composite.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"