Polymorphism is the ability of different objects to be treated through the same interface, while each object can respond in its own way to the same method call. It comes from the Greek for “many shapes,” meaning that a single method or variable can take on multiple forms depending on the object it’s acting on. In practical terms, polymorphism lets you write code that works with general types (like a parent class) but uses the specific behavior of subclasses at runtime.
Back to Inheritance (NOT REQUIRED)
Lesson PreviewLesson 6 of 7 in this unit
9.6 EXTRA: Polymorphism
Part of Inheritance (NOT REQUIRED) in AP® Computer Science A. Read the opening section, then create a free account for the full interactive lesson, practice, and progress tracking.
In this unit
7 lessons
- 9.1EXTRA: Creating Superclasses and SubclassesPreview lesson
- 9.2EXTRA: Writing Constructors for SubclassesPreview lesson
- 9.3EXTRA: Overriding MethodsPreview lesson
- 9.4EXTRA: super KeywordPreview lesson
- 9.5EXTRA: Creating References Using Inheritance HierarchiesPreview lesson
- 9.6EXTRA: PolymorphismThis lesson
- 9.7EXTRA: object SuperclassPreview lesson
Continue the full lesson in Stellar
Create a free account to unlock the remaining sections, checkpoints, course practice, and progress tracking for AP® Computer Science A.