Scenarios Scenarios Scenarios are a formal method of describing the sequence of events in a function that show the interaction of the function with other functions in the same or different classes. Add this cost to the total and return the total. Notice that this function asks each of the items in the list for its cost. If we had not listed a cost function as a member of GroceryItem, it would be clear here that we need such a function.
Scenarios formalize the process of cataloging functions called from a function.
At this point all that you seem to learn from the diagram is if other functions are needed in a this class or another. You will learn that if your function calls a function from a data item that is not a member of of your class, you will have to pass that data item as a parameter of your function. In more complex situations, this function call may actually be a message sent to other parts of your program. This introduces the concept of iterator .