On Sunday, 10 January 2016 at 14:32:02 UTC, Jack wrote:
Hello. So I was trying to pass a delegate as an argument in a
function and was wondering if I'm writing the correct code for
it.
You see my code is :
//
class Foo()
{
void bar()
{
Hello. So I was trying to pass a delegate as an argument in a
function and was wondering if I'm writing the correct code for it.
You see my code is :
//
class Foo()
{
void bar()
{
writeln("Hello World");
}
}
class Bar()
{
void delegate() action;
On 10.01.2016 15:32, Jack wrote:
//
class Foo()
Those parentheses make this a (zero parameter) class template. I suppose
you just want a plain class. Drop them then.
{
void bar()
{
writeln("Hello World");
}
}
class Bar()
ditto
{
void
On Sunday, 10 January 2016 at 14:32:02 UTC, Jack wrote:
...
Just to make your code a little more clear, try using aliases
when defining delegate parameters. Like this:
alias Action = void delegate();
Then in your code you use the alias, like this:
class Bar()
{
private Action _action;