Call method if declared only

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sun Mar 1 08:48:13 UTC 2020


On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote:
> How to implement ?

I would go for a template mixin that implements send operation in 
each subclass. Sine template mixin's content is declared in scope 
of declaration not template's module, the code inside it is aware 
of concrete implementation of your base class, and could 
introspect all methods available in it, and generate your switch 
statement (in send operation) for all supported messages.

This would be just one line of code in each class with no 
complication whatsoever.

Best regards,
Alexandru.


More information about the Digitalmars-d-learn mailing list