
60
Chapter 5: Inheritance and Access Control []
PerformTransaction
1 interface PerformTransaction {
2 public void deposit (double amount);
3 public double withdraw (double amount);
4 }
PerformTran saction
Note that all methods in an interface are public by default; we have chosen to make this explicit.
An interface is not a class, so we do not have a corresponding object. Any class can choose to
implement the PerformTransaction interface where it makes sense to have deposit and withdraw
methods. To implement an interface, include the implements interface_name keyword in the
class declaration, for example,
class InvestmentFund ...