Inheritance_Notes

Inheritance_Notes - final on a method to stop overriding by...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Inheritance Notes 1. Note duplication when writing CheckingAccount and SavingsAccount (deposit(),withdraw(), getBalance(), close()) 2. Create a parent class BankAccount with common methods. The child classes use extends to identify the parent. 3. Show build of the child object, which now also loads the parent as part of the object. 4. Show an application calling parent methods in the child object. 5. Mention the Object class, which provides toString() and other common methods. 6. Show override of the parent close() method in the child. 7. Show use of the super keyword to call an overridden deposit() method. 8. Show use of the super keyword to call a parent constructor (why?) 9. Mention that the compiler adds super() to the top of all constructor code to ensure all constructors are called, and from the top down. 10.Show use of
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: final on a method to stop overriding by a child. 11.Show use of final on a class to stop extending. 12.Show use of abstract to stop instantiation of a parent class. 13.Show use of abstract on a method to force child implementation of function. (Implementation may be delayed to lower layers. ..) 14.Show that an object is given the type of all of its parents (why?) and also interfaces it has implemented (or inherited). 15.Show how it is sometimes handy to type an object as a parent type. (calculateAverageBalance()) to avoid overloading the method. 16.Show use of the instanceof operator to test for an object's type. 17.Show use of Generics with Collection Classes to avoid 1) add errors, and 2)casting on reference 18.Discuss why Java has only "single inheritance" whereas C++ allows "multiple inheritance"....
View Full Document

This note was uploaded on 01/25/2010 for the course ECE 309 taught by Professor Bowman during the Spring '09 term at N.C. State.

Page1 / 2

Inheritance_Notes - final on a method to stop overriding by...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online