Local function overloading

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Apr 12 13:10:55 PDT 2014


On 4/12/14, monarch_dodra <monarchdodra at gmail.com> wrote:
> I know you can workaround it by putting
> your functions a static members of a dummy struct

You can also use a mixin template:

class A {}
class B {}

mixin template M()
{
    void func2(A a) { }
    void func2(B b) { }
}

void main()
{
    mixin M!();

    func2(new A);
    func2(new B);
}


More information about the Digitalmars-d-learn mailing list