annotate tests/mini/interface3.d @ 341:1bb99290e03a trunk

[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author lindquist
date Sun, 13 Jul 2008 02:51:19 +0200
parents test/interface3.d@44a95ac7368a
children 340acf1535d0
rev   line source
lindquist@113 1 module interface3;
lindquist@113 2
lindquist@133 3 extern(C) int printf(char*,...);
lindquist@133 4
lindquist@113 5 interface I
lindquist@113 6 {
lindquist@113 7 void func();
lindquist@113 8 }
lindquist@113 9
lindquist@113 10 class C : I
lindquist@113 11 {
lindquist@113 12 int i = 42;
lindquist@113 13 override void func()
lindquist@113 14 {
lindquist@113 15 printf("hello %d\n", i);
lindquist@113 16 i++;
lindquist@113 17 }
lindquist@113 18 }
lindquist@113 19
lindquist@113 20 void main()
lindquist@113 21 {
lindquist@113 22 scope c = new C;
lindquist@113 23 {c.func();}
lindquist@113 24 {
lindquist@113 25 I i = c;
lindquist@113 26 {i.func();}
lindquist@113 27 }
lindquist@113 28 {printf("final %d\n", c.i);}
lindquist@113 29 {assert(c.i == 44);}
lindquist@113 30 }