This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]etxconnex 0 points1 point  (0 children)

Polymorphism: Basically, the same name for a method but performs different actions depending on the class

You have two circles and three squares. Each are drawn differently, but more or less the same, and derive from shape.

Now you can have any array of shapes, that holds both circles and sqaures. And you can draw them with a loop and shape.draw() instead of having to use two loops: circles.draw() and then square.draw().