|
Is this problem difficult to prevent? A good answer might be:No---usually all the instance variables are declared in one place in the class definition and it is easy to check them. | ||
Method OverloadingOverloading is when two or more methods of a class have the same name but have different parameter lists. When one of the methods is called (by main() or by some other method) it is clear which one is wanted by matching the actual parameter list to the formal parameter lists. Here is a further modification of the CheckingAccount class:
Say that two processDeposit( ) methods were needed:
The above code implements these requirements. Here is an example main() method that uses both methods:
| ||
QUESTION 12:Which of the following is true?
|