Skip to content

Lesson 7 Companion — Polymorphism & Method Redefinition ​

1. SAP dynamic dispatch rule ​

A redefined method is selected according to the actual object, even when the reference is statically typed to a superclass.

2. Method signature ​

REDEFINITION changes implementation, not the inherited method interface.

3. Avoid type-switch logic ​

Repeated type tests are often a sign that the behavior belongs on the polymorphic objects themselves.

4. Table of references ​

A single internal table can hold Book and Movie references because each concrete reference is assignment-compatible with the Product superclass reference type.

SAP references ​