| OLD | NEW |
| 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 |
| 1 class Foo {} | 5 class Foo {} |
| 2 | 6 |
| 3 class Bar extends Foo {} | 7 class Bar extends Foo {} |
| 4 | 8 |
| 5 class Base { | 9 class Base { |
| 6 Foo method() { | 10 Foo method() { |
| 7 return new Foo(); | 11 return new Foo(); |
| 8 } | 12 } |
| 9 } | 13 } |
| 10 | 14 |
| 11 class Sub extends Base { | 15 class Sub extends Base { |
| 12 Foo method() { | 16 Foo method() { |
| 13 return new Bar(); | 17 return new Bar(); |
| 14 } | 18 } |
| 15 } | 19 } |
| 16 | 20 |
| 17 main(List<String> args) { | 21 main(List<String> args) { |
| 18 var object = args.length == 0 ? new Base() : new Sub(); | 22 var object = args.length == 0 ? new Base() : new Sub(); |
| 19 var a = object.method(); | 23 var a = object.method(); |
| 20 print(a); | 24 print(a); |
| 21 } | 25 } |
| OLD | NEW |