OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 class Base { | 7 class Base { |
8 int i, j; | 8 int i, j; |
9 Base.ctor(int i, this.j) : this.i = i + 7; | 9 Base.ctor(int i, this.j) : this.i = i + 7; |
10 } | 10 } |
11 | 11 |
12 abstract class M { | 12 abstract class M { |
13 get i; | 13 int get i; |
14 get j; | 14 int get j; |
15 int k = 42; | 15 int k = 42; |
16 foo() => i + j; | 16 foo() => i + j; |
17 } | 17 } |
18 | 18 |
19 class C extends Base with M { | 19 class C extends Base with M { |
20 int l = 131; | 20 int l = 131; |
21 C() : super.ctor(1, 13); | 21 C() : super.ctor(1, 13); |
22 } | 22 } |
23 | 23 |
24 main() { | 24 main() { |
25 C c = new C(); | 25 C c = new C(); |
26 Expect.equals(8, c.i); | 26 Expect.equals(8, c.i); |
27 Expect.equals(13, c.j); | 27 Expect.equals(13, c.j); |
28 Expect.equals(42, c.k); | 28 Expect.equals(42, c.k); |
29 Expect.equals(131, c.l); | 29 Expect.equals(131, c.l); |
30 Expect.equals(21, c.foo()); | 30 Expect.equals(21, c.foo()); |
31 } | 31 } |
OLD | NEW |