Explorar o código

Small change in output : Methods of factory should print 'We have...' since they are the once only producing the object', object specific methods can start from 'It is ...'

Arovit Narula %!s(int64=11) %!d(string=hai) anos
pai
achega
760d693ce1
Modificáronse 1 ficheiros con 9 adicións e 9 borrados
  1. 9 9
      abstract_factory.py

+ 9 - 9
abstract_factory.py

@@ -23,9 +23,9 @@ class PetShop:
         abstract factory"""
 
         pet = self.pet_factory.get_pet()
-        print("This is a lovely {}".format(pet))
+        print("We have a lovely {}".format(pet))
         print("It says {}".format(pet.speak()))
-        print("It eats {}".format(self.pet_factory.get_food()))
+        print("We also have {}".format(self.pet_factory.get_food()))
 
 
 # Stuff that our factory makes
@@ -83,15 +83,15 @@ if __name__ == "__main__":
         print("=" * 20)
 
 ### OUTPUT ###
-# This is a lovely Dog
+# We have a lovely Dog
 # It says woof
-# It eats dog food
+# We also have dog food
 # ====================
-# This is a lovely Cat
-# It says meow
-# It eats cat food
+# We have a lovely Dog
+# It says woof
+# We also have dog food
 # ====================
-# This is a lovely Dog
+# We have a lovely Dog
 # It says woof
-# It eats dog food
+# We also have dog food
 # ====================