Forwarding or merging 'this' into a child class to aid chaining methods?

anonymous anonymous at example.com
Thu Mar 6 11:48:59 PST 2014


On Thursday, 6 March 2014 at 19:30:25 UTC, Ali Çehreli wrote:
> On 03/06/2014 11:16 AM, anonymous wrote:
[...]
> > http://dlang.org/template.html#TemplateThisParameter
[...]
> "type of the this reference" does not explain that it is about 
> the type of the most derived object.

Well, it isn't. It works with new Bar().bar().foo(), because new
Bar().bar() is a Bar. This wouldn't work: Foo foo = new
Bar().bar(); Bar bar = foo.foo();


More information about the Digitalmars-d-learn mailing list