extends and Method Overriding
Share and specialize parent behavior.
Sharing Behavior
When two classes share most of their behavior, you can write it once and reuse it. Dart calls this inheritance, and it saves you from copy-paste. 🌱
The extends Keyword
You inherit by writing extends after a class name. The new class is a child that automatically gains the parent's fields and methods.
class Animal {}
class Dog extends Animal {}All lessons in this course
- extends and Method Overriding
- Calling super and Constructor Chaining
- Mixins With the with Keyword
- on Constraints and Mixin Order