On Thursday, 4 January 2018 at 01:40:21 UTC, Mark wrote:
What I'm trying to do here is to be able to call a function based off of a key.



class tester {

        private void delegate() [char] funcs;

        this() {
                funcs = ['a': &A, 'b': &B];
        }

        public void callFuncs(char a) {
                funcs[a]();
        }

        private void A() {
                writeln("A");
        }

        private void B() {
                writeln("B");
        }
}


Reply via email to