Преглед на файлове

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 преди 11 години
родител
ревизия
760d693ce1
променени са 1 файла, в които са добавени 9 реда и са изтрити 9 реда
  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
 # ====================