Friday, May 17, 2013

mixins


Mixins are "donor" classes that can be included in "recipient" classes, merging the members (properties and methods) of the "donor" class into the "recipient" class.

This is actually a form of multiple inheritance, as the "donor" class's (ie the mixin class) methods and properties can be accessed as if they were of the parent class.

The point of mixins is usually to add functionality from an encapsulated class into the current class without having to make the current class a subclass of the encapsulated class that has the functionality we want.

No comments:

Post a Comment