How can I get the "owner" of a method?

Salih Dincer salihdb at hotmail.com
Fri Sep 30 22:20:06 UTC 2022


On Friday, 30 September 2022 at 21:11:48 UTC, solidstate1991 
wrote:
> Let's say I have a class or an interface with a function, and I 
> want to pass that to a template to generate another function 
> (in this case one that passes it to a scripting engine, and 
> allows it to be called from there).
>

Maybe this will help you:
```d
template Bar(T)
{
   void fun() {}
}

class Foo(T)
{
   mixin Bar!T b;
   alias fun = b.fun;

   void test()
   {
     fun();
   }
}
```
SDB at 79


More information about the Digitalmars-d-learn mailing list