view tests/mini/interface3.d @ 1578:1dee66f6ec0b

Removed a chunk of code in favour of a shorter and more portable method
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 08 Sep 2009 11:21:30 +0100
parents 340acf1535d0
children
line wrap: on
line source

module interface3;

extern(C) int printf(char*,...);

interface I
{
    void func();
}

class C : I
{
    int i = 42;
    override void func()
    {
        printf("hello %d from %p\n", i, this);
        i++;
    }
}

void main()
{
    auto c = new C;
    {c.func();}
    {
        I i = c;
        {i.func();}
    }
    {printf("final %d\n", c.i);}
    {assert(c.i == 44);}
}