Created
March 7, 2020 22:28
-
-
Save jodinathan/2d17d3d4cfaa18afb7e75e57dc770786 to your computer and use it in GitHub Desktop.
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
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