How to return a function and then call it later?
d, function, return, return-type
Solution
import std.stdio;
struct Script
{
int x, y;
}
void foo(Script e)
{
writeln("Got: ", e);
}
void function(Script e) getfoo()
{
return &foo;
}
void main(string[] args)
{
auto func = getfoo();
func(Script(1, 2));
}
Problem
So lets say I have this struct a and a void method that takes that struct in as a parameter. How would I be able to return the void method through another method and then call it later? The code I have looks like this: ``` struct Script{ //variables } void foo(Script e) { } function getfoo() { return foo; } void main(string[] args) { writeln("Hello World!"); stdin.readln(); } ```