|
Computer Science (CSCI)
Department |
|||
|
|||
Inheritance
(Example code and figures from Computing Concepts with Java Essentials, 3rd
edition, by Cay Horstmann.
Visit www.wiley.com/college/horstmann
for information on the current edition of this excellent text.)
class SavingsAccount extends BankAccount |

public class SavingsAccount extends BankAccount |
a SavingsAccount object
SavingsAccount retirement = new SavingsAccount(10.0); retirement.deposit(10000.0); |
inheritance hierarchies
part of the hierarchy of Swing UI components
inheritance and methods
inheritance and instance variables
a bank account hierarchy

the CheckingAccount class
inherited private instance variables are still private
public void deposit(double amount) |
invoking a superclass method
public void deposit(double amount) |
superclass construction
public class CheckingAccount extends BankAccount |
|
Exercise - extend an existing class in the BankAccount
project
|