Mercurial > projects > dstress
annotate run/alias_04.d @ 0:3269e4627918
init dstress
author | svnowner |
---|---|
date | Sat, 25 Sep 2004 22:33:30 +0000 |
parents | |
children | 3414705c41ac |
rev | line source |
---|---|
0 | 1 // $Header: /home/th/Dokumente/Entwicklung/MEIN_CVS/MiniD/src/run/alias_04.d,v 1.1 2004/08/20 23:42:51 th Exp $ |
2 | |
3 class A { | |
4 int foo(int a) { return 1; } | |
5 } | |
6 | |
7 class B : A { | |
8 int foo( int a, uint b ) { return 2; } | |
9 } | |
10 | |
11 class C : B { | |
12 int foo( int a ) { return 3; } | |
13 alias B.foo foo; | |
14 } | |
15 | |
16 class D : C { | |
17 } | |
18 | |
19 | |
20 int main(){ | |
21 D d = new D(); | |
22 | |
23 assert(d.foo(1, 2u) == 2); // calls B.foo | |
24 assert(d.foo(1) == 3); // calls C.foo | |
25 return 0; | |
26 } |