| 1 |
/* PERMUTE_ARGS: |
| 2 |
REQUIRED_ARGS: -verrors=simple |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
runnable/future.d(17): Deprecation: method `future.B.msg` implicitly overrides `@__future` base class method; rename the former |
| 6 |
runnable/future.d(12): base method `future.A.msg` defined here |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
class A |
| 11 |
{ |
| 12 |
@__future char msg() { return 'a'; } |
| 13 |
} |
| 14 |
|
| 15 |
class B : A |
| 16 |
{ |
| 17 |
char msg() { return 'b'; } |
| 18 |
} |
| 19 |
|
| 20 |
class C : B |
| 21 |
{ |
| 22 |
override char msg() { return 'c'; } |
| 23 |
} |
| 24 |
|
| 25 |
class D : A |
| 26 |
{ |
| 27 |
override char msg() { return 'd'; } |
| 28 |
} |
| 29 |
|
| 30 |
int main() |
| 31 |
{ |
| 32 |
auto a = new A(); |
| 33 |
assert(a.msg() == 'a'); |
| 34 |
auto b = new B(); |
| 35 |
assert(b.msg() == 'b'); |
| 36 |
auto c = new C(); |
| 37 |
assert(c.msg() == 'c'); |
| 38 |
auto d = new D(); |
| 39 |
assert(d.msg() == 'd'); |
| 40 |
|
| 41 |
assert(b.A.msg() == 'a'); |
| 42 |
|
| 43 |
auto ba = cast(A)b; |
| 44 |
assert(ba.msg() == 'a'); |
| 45 |
|
| 46 |
auto da = cast(A)d; |
| 47 |
assert(da.msg() == 'd'); |
| 48 |
return 0; |
| 49 |
} |