I just want very much avoid renaming function,it's principle for me.
So I would like to know is my sample right or no.

I think that the main overall principle here is that is it impossible to have two functions which differ only by static attribute. I even do not imagine the use case of this.

Well, here is the most natural way to achieve similar effect, I suppose:

struct MyStruct {

        struct Static {

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

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

        static Static opCall() {
                return Static();
        }
}


MyStruct obj;

obj.myfun(); //dynamic;
MyStruct().myfun(); //static;

Reply via email to