Skip to content

Commit f603e3f

Browse files
author
Sakis Kasampalis
committed
improve string representation for abstract_factory
1 parent a4f99ed commit f603e3f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

abstract_factory.py

+11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ def __init__(self, animal_factory=None):
1414

1515
self.pet_factory = animal_factory
1616

17+
18+
def show_pet(self):
19+
"""Creates and shows a pet using the
20+
abstract factory"""
21+
22+
pet = self.pet_factory.get_pet()
23+
print("This is a lovely {}".format(pet))
24+
print("It says {}".format(pet.speak()))
25+
print("It eats {}".format(self.pet_factory.get_food()))
26+
27+
1728
def show_pet(self):
1829
"""Creates and shows a pet using the
1930
abstract factory"""

0 commit comments

Comments
 (0)