Passing Function as an argument to another Function
Vino
vino.bheeman at hotmail.com
Mon Dec 4 08:22:42 UTC 2017
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
More information about the Digitalmars-d-learn
mailing list