Polymorphism with Inheritance

CS2 / Java

Authors

  • Kate Holdener Saint Louis University

Abstract

This activity introduces the concept of Polymorphism through a mechanism that the students have already used earlier in the course (using System.out.println to print Java objects in a human readable format) and invites students to “invent” the implementation of the println method. The students explore the concept of inheritance, one of ways to achieve polymorphism in Java, invent the rules behind inheritance (what methods can be used on what objects), and apply method overriding to prove that subclasses retain their original definition, even when used in a polymorphic way.  After completing this activity the students are expected to be able to explain the concept of polymorphism, understand how polymorphism can be achieved with inheritance, and override superclass methods.

This activity was developed with NSF support through IUSE-1626765. You may request access to this activity via the following link: IntroCS-POGIL Activity Writing Program

  • Level: undergraduate
  • Setting: computer classroom
  • Activity type: Learning Cycle
  • Discipline: Computer Science
  • Course: CS2 / Java
  • Keywords: inheritance, polymorphism

Downloads

Published

2023-01-08

How to Cite

Holdener, K. (2023). Polymorphism with Inheritance: CS2 / Java. POGIL Activity Clearinghouse, 3(4). Retrieved from https://pac.pogil.org/index.php/pac/article/view/263

Issue

Section

CS-POGIL Activity Writing Program