0PricingLogin
Dart Academy · Lesson

Polymorphism Through Shared Types

Program to a type, not a class.

What Polymorphism Means

Polymorphism lets one type stand in for many. You call a method on a shared type and each object responds in its own way.

Program to a Type

Instead of naming a concrete class, you depend on a shared supertype. Your code works with anything that fits that shape.

void render(Shape s) => print(s.area());

All lessons in this course

  1. Abstract Classes and Abstract Methods
  2. Implicit Interfaces and implements
  3. Polymorphism Through Shared Types
  4. Composition Over Inheritance
← Back to Dart Academy