Last active
May 3, 2018 21:58
-
-
Save Sfshaza/24b24776b4469181b7b5a6040f0fb8a8 to your computer and use it in GitHub Desktop.
Java-to-Dart codelab: Final Bicycle example
This file contains hidden or 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
class Bicycle { | |
int cadence; | |
int _speed; | |
int gear; | |
Bicycle(this.cadence, this._speed, this.gear); | |
int get speed => _speed; | |
void applyBrake(int decrement) { | |
_speed -= decrement; | |
} | |
void speedUp(int increment) { | |
_speed += increment; | |
} | |
@override | |
String toString() => 'Bicycle: $_speed mph'; | |
} | |
main() { | |
var bike = new Bicycle(2, 0, 1); | |
print(bike); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will be replaced by https://gist.github.com/bdc6a0c88482c4492912cc2849aa5121.