Ordinarily, it is not possible to create an array of different object types. However, since Burger, Fries, and Sauce all conform to CalorieCountProtocol, we can make an array that contains them:
- Type in the following code after all of the protocol and object declarations and run it. Since all of the food items conform to the CalorieCountProtocol protocol, you can add them to foodArray.
// create instances of each typelet burger = Burger()let fries = Fries()let sauce = Sauce.tomato// print the descriptionsprint(burger.description())print(fries.description())print(sauce.description())// since all items have adopted the same protocol, you can add them to a single arraylet foodArray : [CalorieCountProtocol] ...