diff test/interface4.d @ 113:27b9f749d9fe trunk

[svn r117] Initial working implementation of interfaces. Groundwork for all the different types of class/interface casts laid out.
author lindquist
date Sat, 24 Nov 2007 06:33:00 +0100
parents
children 44a95ac7368a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/interface4.d	Sat Nov 24 06:33:00 2007 +0100
@@ -0,0 +1,33 @@
+module interface4;
+
+interface I
+{
+    void func();
+}
+
+interface I2
+{
+    void func();
+}
+
+class C : I,I2
+{
+    int i = 42;
+    override void func()
+    {
+        printf("hello %d\n", i);
+        i++;
+    }
+}
+
+void main()
+{
+    scope c = new C;
+    c.func();
+    I i = c;
+    i.func();
+    I2 i2 = c;
+    i2.func();
+    printf("final %d\n", c.i);
+    assert(c.i == 45);
+}