Challenge: Solution Review
This lesson will explain the solution to the problem from the previous coding challenge.
We'll cover the following...
We'll cover the following...
Solution #
Explanation #
Let’s start by looking at the original code first:
In the example, there is a BankAccount class which contains the following functions:
-
checkAmount: returns theamountin the account -
withdrawMoney: withdraws an amount -
depositAmount: deposits an amount
An account object will be able to call on these functions directly. With the command pattern, we will change that. This means the object executing the function will be separated from the one requesting. As mentioned in the question, the command ...