INTRODUCTION TO MIXINS














































INTRODUCTION TO MIXINS



INTRODUCTION TO MIXINS

 

 

 

To extend the features of the EventDispatcher/EventQueue inheritance tree, code is injected using a mixin. EventDispatcher will be used as an example in this paper; EventQueue's functionality is identical. A mixins is a class created to add functionality to another class, typically by using a base class that already has the necessary capabilities.

 

 

The EventDispatcher's initial inheritance hierarchy looks like,

 

 

EventDispatcher <- EventDispatcherBase

 

 

After two mixin A and B are injected, the hierarchy looks like,

 

EventDispatcher <- MixinA <- MixinB <- EventDispatcherBase

 

 

 

 

All types, functions, and data (public and protected members) of EventDispatcherBase are accessible to mixins. The user can see and utilise every public member in the mixins.

 


Comments