| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, 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 // Dart test program for testing setting/getting of fields when | |
| 5 // only getter/setter methods are specified. | |
| 6 | |
| 7 class First { | |
| 8 First(int val) : a_ = val { } | |
| 9 int a_; | |
| 10 } | |
| 11 | |
| 12 class Second extends First { | |
| 13 static int c; | |
| 14 | |
| 15 Second(int val) : super(val) { } | |
| 16 | |
| 17 static void testStaticMethod() { | |
| 18 int i; | |
| 19 Second.static_a = 20; | |
| 20 i = Second.c; | |
| 21 } | |
| 22 | |
| 23 void set instance_a(int value) { | |
| 24 a_ = a_ + value; | |
| 25 } | |
| 26 int get instance_a() { | |
| 27 return a_; | |
| 28 } | |
| 29 | |
| 30 static void set static_a(int value) { | |
| 31 Second.c = value; | |
| 32 } | |
| 33 | |
| 34 static int get static_d() { | |
| 35 return Second.c; | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 class Setter0Test { | |
| 40 static testMain() { | |
| 41 Second obj = new Second(10); | |
| 42 Expect.equals(10, obj.instance_a); | |
| 43 obj.instance_a = 20; | |
| 44 Expect.equals(30, obj.instance_a); | |
| 45 | |
| 46 Second.testStaticMethod(); | |
| 47 Expect.equals(20, Second.c); | |
| 48 Expect.equals(20, Second.static_d); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 | |
| 53 main() { | |
| 54 Setter0Test.testMain(); | |
| 55 } | |
| OLD | NEW |