Created
July 6, 2019 12:46
-
-
Save ryanlid/0efe874b771e984df1f8001e1801fba5 to your computer and use it in GitHub Desktop.
(flutter) dart class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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