Need encouraging...

Arlen Albert Keshabyan arlen.albert at gmail.com
Thu Oct 4 02:25:47 PDT 2007


Bill Baxter Wrote:

> If you're patient enough to translate 150,000 lines of code to D then 
> maybe you can be patient enough to take just a few moments to explain to 
> us how JUCE uses multiple inheritance.
> 
> --bb

...most of the time, JUCE uses multiple inheritance to add a 'listener' type to your class. If you want to listen to any specific events then you may inherit from several listener classes to get all that listener types within your class. Then you may pass your class pointer to other classes that expect one of your inherited listener type to let you receive desired events (virtual functions).

e.g. If I want to receive the Timer events, Mouse events, Keyboard events, want to add Text flavor and some of my custom classes flavor to my new class then I need to inherit from all that classes. Moreover, sometimes I need to use a sole instance of the classes described above.

D templates are weak used in mixins because virtual functions with the same names are overlaid and become inaccessible, there are no good way to distinguish constructors and destructors in templates. D interfaces are excessive on writing many more additional code lines to implement all functions declared in an interface. D's abstract classes are restricted to single inheritance too. Container classes (compositing) and interfaces are just hell-copy-paste and hell-code-changes-concerns-all-copy-pasted-lines. D signals are not suitable in this cases because classes can be reused solely without any event (signal) concern (dont want to write ugly classes)...

...



More information about the Digitalmars-d mailing list