Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created July 6, 2019 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/0efe874b771e984df1f8001e1801fba5 to your computer and use it in GitHub Desktop.
Save ryanlid/0efe874b771e984df1f8001e1801fba5 to your computer and use it in GitHub Desktop.
(flutter) dart class
void main() {
Car myCar = Car();
print(myCar.numberOfSeat);
myCar.drive();
ElectriCar myTesla = ElectriCar();
myTesla.drive();
print(myTesla.batteryLevel);
}
class Car {
int numberOfSeat = 5;
void drive() {
print('wheel turn');
}
}
class ElectriCar extends Car {
int batteryLevel = 100;
void recharge() {
batteryLevel = 100;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment