]>
Commit | Line | Data |
---|---|---|
7da827c9 IB |
1 | /* |
2 | TEST_OUTPUT: | |
3 | --- | |
4 | fail_compilation/fail94.d(28): Error: cannot implicitly override base class method `fail94.A.clone` with `fail94.B.clone`; add `override` attribute | |
5 | --- | |
6 | */ | |
b4c522fa IB |
7 | interface I |
8 | { | |
9 | int foo(); | |
10 | } | |
11 | ||
12 | class IA : I | |
13 | { | |
14 | int foo() { return 1; } | |
15 | } | |
16 | ||
17 | class A | |
18 | { | |
19 | I i; | |
20 | ||
21 | I clone() { return i; } | |
22 | } | |
23 | ||
24 | class B : A | |
25 | { | |
26 | IA ia; | |
27 | ||
28 | IA clone() | |
29 | out (result) | |
30 | { | |
31 | printf("B.clone()\n"); | |
32 | } | |
5fee5ec3 | 33 | do { return ia; } |
b4c522fa IB |
34 | } |
35 | ||
36 | void main() | |
37 | { | |
38 | IA ia = new IA; | |
39 | assert(ia.foo() == 1); | |
40 | ||
41 | I i = ia; | |
42 | assert(i.foo() == 1); | |
43 | ||
44 | A a = new A; | |
45 | a.i = i; | |
46 | assert(a.clone().foo() == 1); | |
47 | ||
48 | B b = new B; | |
49 | b.ia = ia; | |
50 | assert(b.clone().foo() == 1); | |
51 | ||
52 | a = b; | |
53 | assert(a.clone().foo() == 1); | |
54 | ||
55 | bar(&b.clone); | |
56 | } | |
57 | ||
58 | ||
59 | void bar(IA delegate() dg) | |
60 | { | |
61 | } |