Re: passing subclass to superclass where parameter is a delegate for the superclass

2018-11-14 Thread Alex via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 16:39:52 UTC, Alex wrote: Are you looking for this? https://dlang.org/phobos/std_traits.html#TransitiveBaseTypeTuple It matches however not exactly your needs: As all objects are derived from the Object class, you will always get it as the common parent. So...

Re: passing subclass to superclass where parameter is a delegate for the superclass

2018-11-14 Thread Alex via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 16:06:21 UTC, Chris Bare wrote: If I have: class base { void delegate(base) stored_dg; void add_function (void delegate (base) dlg) { stored_dg = dlg; } } class A : base { this () { super (); add_function (&th

passing subclass to superclass where parameter is a delegate for the superclass

2018-11-14 Thread Chris Bare via Digitalmars-d-learn
If I have: class base { void delegate(base) stored_dg; void add_function (void delegate (base) dlg) { stored_dg = dlg; } } class A : base { this () { super (); add_function (&this.foo); } void foo (A a) { log ("i got here")