On Sunday, 13 January 2013 at 17:59:28 UTC, Andrey wrote:
Don't know if this will be useful in any manner, but it came this silly way:

class MyClass {

        struct _static {

                static void myfun() {
                        writeln("static myfun");
                }
        }

        void myfun() {
                writeln("myfun");
        }

}

void main() {

auto obj = new MyClass();
obj.myfun(); //myfun
obj._static.myfun(); //static
MyClass._static.myfun(); //static

}
Aha...Thank you,very interesting idea to hide function in struct:


struct Foo
{
        static struct bar
        {
        static void opCall()
        {
                writeln("static");
        }
        void bar()
        {
                writeln("non-static");
        }
        }
}

This is the workaround I looked for.

Reply via email to