Last active
April 4, 2025 09:14
-
-
Save rena2019/05ec3bede00f5ec8aca55f772e9d9098 to your computer and use it in GitHub Desktop.
myconstructors.dart
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 PointA { | |
double x = 1.0; | |
double y = 2.0; | |
// The implicit default constructor sets these variables to (1.0,2.0) | |
// PointA(); | |
// | |
PointA(String s) : x = double.parse(s), y = double.parse(s); | |
@override | |
String toString() { | |
return 'PointA($x, $y)'; | |
} | |
} | |
void main() { | |
PointA point = PointA("1.5"); | |
print(point); | |
} | |
// https://gist.github.com/rena2019/05ec3bede00f5ec8aca55f772e9d9098 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment