On Tuesday, 25 February 2014 at 11:04:24 UTC, Steve Teale wrote:
On Tuesday, 25 February 2014 at 10:23:32 UTC, Steve Teale wrote:
I'm writing a little example program that illustrates what I'm getting at, and I'll post it somewhere when I'm through.

OK, it's at britseyeview.com/cumulative.txt.

However, I now realize you can do better in D. The base class needs to define an array of delegates. It appends its handler to the array, then derived classes each append their handler. The append is done like:

handlers ~= &Red.handleCommand;

Am I right in thinking that this makes the calls non-virtual? Anyway, the result is I think exactly what I wanted.

The example is at britseyeview.com/cum2.txt.

Steve

Reply via email to