Created
March 7, 2020 22:29
-
-
Save jodinathan/c7be0257f325759f5301458220a9f47c to your computer and use it in GitHub Desktop.
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 Complex { | |
num _real; | |
num _imaginary; | |
num get real => _real; | |
num get imaginary => _imaginary; | |
set real(num r) { | |
if(r < 0) return; | |
_real = r; | |
} | |
} | |
void main() async { | |
var a = Complex(); | |
a.real = 123; | |
print(a.real); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment