Mercurial > projects > dstress
comparison run/overload_02.d @ 0:3269e4627918
init dstress
author | svnowner |
---|---|
date | Sat, 25 Sep 2004 22:33:30 +0000 |
parents | |
children | 3414705c41ac |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3269e4627918 |
---|---|
1 // $Header: /home/th/Dokumente/Entwicklung/MEIN_CVS/MiniD/src/run/overload_02.d,v 1.1 2004/08/20 23:42:53 th Exp $ | |
2 | |
3 int status; | |
4 | |
5 struct MyStruct{ | |
6 void check( byte b){ | |
7 status+=b; | |
8 } | |
9 void check( short s ){ | |
10 status-=s; | |
11 } | |
12 void check( int i ){ | |
13 status+= i*2; | |
14 } | |
15 } | |
16 | |
17 int main(){ | |
18 MyStruct S; | |
19 | |
20 byte b = 2; | |
21 short s = 3; | |
22 int i = 4; | |
23 | |
24 assert(status == 0); | |
25 S.check(b); | |
26 assert(status == 2); | |
27 S.check(s); | |
28 assert(status == -1); | |
29 S.check(i); | |
30 assert(status == 7 ); | |
31 return 0; | |
32 } | |
33 |