Dynamic templated virtuals - I still often want them

zjh fqbqrr at 163.com
Mon Mar 14 07:59:00 UTC 2022


On Monday, 14 March 2022 at 07:48:49 UTC, bauss wrote:
> On Saturday, 12 March 2022 at 05:10:10 UTC, surlymoor wrote:
>> On Thursday, 23 July 2020 at 02:38:27 UTC, Adam D. Ruppe wrote:
>>> ...
>

but this fails:
```d
class Base {
     string serialize(this This)() {
         string _stringof = This.stringof;
         return _stringof;
     }
  }
  class Derived : Base {
  }

  void main() {
     Base b = new Derived();
     assert(b.serialize() == "Derived");
}
```


More information about the Digitalmars-d mailing list