[Issue 4542] [tdpl] TDPL NVI example results in linker error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 8 20:22:51 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4542



--- Comment #10 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-09-08 20:22:35 PDT ---
Isn't this what NVI is all about?

import std.stdio;

interface Foo
{
    final void callable()
    {
        impl1();
        impl2();
    }

    void impl1();
    void impl2();
}

class Bar : Foo
{
    @disable void impl1() { writeln("impl1"); }
    @disable void impl2() { writeln("impl2"); }
}

void main()
{
    Foo foo = new Bar();
    foo.callable();
}

You can't directly call impl1() from within Bar, however you can call it via
the Foo interface. I think this is pretty much it, no?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list