Lecture 12 Objectives
At the end of today's class you should
KNOW:
- That encapsulation involves separating a module's implementation
details from its API
- That classes provide a mechanism for bundling together data and
operations on the data
- That access modifiers provide a mechanism for controlling access
to fields and methods
- That although subclasses inherit private fields, those fields are not
accessible by name in the subclass
- That subclasses do not inherit private methods
- That well-designed software is written in a way that allows for
changes in the underlying data structure
BE ABLE TO:
- Choose the appropriate class for a method definition
- Choose the appropriate access modifier for a field or method
- Design a hierarchy that is not dependent on a particular underlying
data structure
Sample Exam Question:
Add a deposit()
method to the BankingService class we developed.
deposit()
consumes an account number and an amount to deposit
and adds the amount to the balance in the account. The method returns the
new account balance.