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 abstract class Mixin1 { | 7 abstract class Mixin1 { |
8 var mixin1Field = 1; | 8 var mixin1Field = 1; |
9 } | 9 } |
10 | 10 |
11 abstract class Mixin2 { | 11 abstract class Mixin2 { |
12 var mixin2Field = 2; | 12 var mixin2Field = 2; |
13 } | 13 } |
14 | 14 |
15 class A { | 15 class A { |
16 var superField; | 16 var superField; |
17 A([this.superField = 3]); | 17 A() : superField = 3; |
18 } | 18 } |
19 | 19 |
20 class B extends A with Mixin1, Mixin2 { | 20 class B extends A with Mixin1, Mixin2 { |
21 var field = 4; | 21 var field = 4; |
22 } | 22 } |
23 | 23 |
24 main() { | 24 main() { |
25 var b = new B(); | 25 var b = new B(); |
26 Expect.equals(1, b.mixin1Field); | 26 Expect.equals(1, b.mixin1Field); |
27 Expect.equals(2, b.mixin2Field); | 27 Expect.equals(2, b.mixin2Field); |
28 Expect.equals(3, b.superField); | 28 Expect.equals(3, b.superField); |
29 Expect.equals(4, b.field); | 29 Expect.equals(4, b.field); |
30 } | 30 } |
OLD | NEW |