comparison run/typeof_04.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/typeof_04.d,v 1.1 2004/08/20 23:42:55 th Exp $
2
3 class A {
4 int value(){
5 return 'A';
6 }
7 }
8
9 class B : A {
10 int value(){
11 return 'B';
12 }
13
14 typeof(super) a; // y is declared to be an A
15 typeof(this) b; // x is declared to be a B
16
17 this(){
18 a = new A();
19 //b = new B();
20 }
21 }
22
23 int main(){
24 B b = new B();
25
26 assert(b.value == 'B');
27 assert(b.a.value == 'A');
28 //assert(b.b.value == 'B');
29
30 return 0;
31 }