On 04/12/2017 8:22 AM, Vino wrote:
Hi All,

  Request your help on the below code, I want to send the name of the function ( First and Second) from main as an argument to another function(Mid) and the function "Mid" has to execute the function(First and Second).

Program:
import std.stdio;

void First (string Ftext) {
writeln("First :", Ftext);
}

void Second (string Stext) {
writeln("Second :", Stext);
}

void Mid( string Fun, string Mtext) {
Fun(Mtext);
}

void main () {
string Ftext = "FTest1";
string Stext = "STest2";
Mid(First, Mtext);
Mid(Second, Stext);
}

From,
Vino.B

Not going to happen like that.

void mid(void function(string) func, string mtext) {
        func(mtext);
}

void main() {
        string ftext = "ftest1",
                stext = "stest2";
        mid(&first, ftext);
        mid(&second, stext);
}

Reply via email to