OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library object_property_access_test; |
| 6 |
| 7 main() { |
| 8 var a1 = new A(); |
| 9 print(a1.a); |
| 10 print(a1.b); |
| 11 |
| 12 a1.a = 3; |
| 13 print(a1.doubleA); |
| 14 |
| 15 var a2 = new A.withArgs(1, 2); |
| 16 print(a2.a); |
| 17 print(a2.b); |
| 18 |
| 19 print(a2.doubleA); |
| 20 a2.setA = 42; |
| 21 print(a2.a); |
| 22 } |
| 23 |
| 24 class A { |
| 25 int a; |
| 26 int b = 42; |
| 27 |
| 28 A(); |
| 29 A.withArgs(this.a, this.b); |
| 30 |
| 31 int get doubleA => a + a; |
| 32 |
| 33 void set setA(int a) { |
| 34 this.a = a; |
| 35 } |
| 36 } |
OLD | NEW |