diff test/interface2.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/interface2.d	Sat Nov 24 06:33:00 2007 +0100
@@ -0,0 +1,35 @@
+module interface2;
+
+interface A
+{
+    void a();
+}
+
+interface B
+{
+    void b();
+}
+
+class C : A,B
+{
+    int i = 0;
+    override void a()
+    {
+        printf("hello from C.a\n");
+    }
+    override void b()
+    {
+        printf("hello from C.b\n");
+    }
+}
+
+void main()
+{
+    scope c = new C;
+    {c.a();
+    c.b();}
+    {A a = c;
+    a.a();}
+    {B b = c;
+    b.b();}
+}