Skip to content

Instantly share code, notes, and snippets.

@MelbourneDeveloper
Last active May 30, 2023 06:40
Show Gist options
  • Select an option

  • Save MelbourneDeveloper/9b59d4c04d314e38afeda6aea6127dcc to your computer and use it in GitHub Desktop.

Select an option

Save MelbourneDeveloper/9b59d4c04d314e38afeda6aea6127dcc to your computer and use it in GitHub Desktop.
Vehicle Example
class Vehicle {
//Defaults to car
String get type => "car";
void drive() {
print("You're driving a $type.");
}
}
class Tractor implements Vehicle {
@override
String get type => 'tractor';
@override
void drive() {
print("You're driving a $type.");
}
}
void main() {
final car = Vehicle();
car.drive();
final tractor = Tractor();
tractor.drive();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment