Inheritance
extends creates a subclass. super calls the parent and @override marks a replaced method.
Example
class Animal {
String sound() => "...";
}
class Cat extends Animal {
@override
String sound() => super.sound() + " meow";
}
void main() => print(Cat().sound());Exercise
Inherit.
class Cat Animal
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.