if class a is an ancestor of class b then class b is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A base class is also known as a parent class or the superclass. • A derived class is also known as a child class or the subclass. • An ancestor class is a class that is a parent or parent of a parent (etc.). • If class A is an ancestor of class B, then class B is a descendant class of class A. CS133 Course Notes Lecture 14, Slide 24 CS133 Course Notes Lecture 14, Slide 23 23 24 Terminology • X is a Y means class X extends Y (or extends an earlier extension of Y). • X has a Y means class X has an instance variable of type Y. CS133 Course Notes Lecture 14, Slide 25 Definitions • Overriding is when a method with the same signature as in a superclass is written in a subclass. – Example: CoopStudent's calcFees overrides Student's calcFees • Overloading is when there are at least two different methods with the same name and return type, but with different types or numbers of parameters. – Example: constructor in Student is overloaded CS133 Course Notes Lecture 14, Slide 26 25 26 Summary • • • • Inheritance Superclass, subclass Hierarchy super(…) • Overriding methods CS133 Course Notes Lecture 14, Slide 27 27 ERROR: undefined OFFENDING COMMAND: STACK:...
View Full Document

Ask a homework question - tutors are online