view tests/mini/interface5.d @ 1651:cb960b882ca3 default tip

bindings were moved to dsource.org/projects/bindings/
author Moritz Warning <moritzwarning@web.de>
date Thu, 20 May 2010 20:05:03 +0200
parents dde9dbae052a
children
line wrap: on
line source

module interface5;

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

interface I
{
    void func();
}

class C : I
{
    int i;
    void func()
    {
        printf("C\n");
        i++;
    }
}

void main()
{
    C c = new C;
    c.func();
    {
        I i = c;
        i.func();

        C c2 = cast(C)i;
        c2.func();

        c.func();
        assert(c.i == 4);
    }
}