Mixins is another useful construct, not as popularly known, that can be leveraged in certain scenarios to get a job done. The basic idea is to build larger more complete classes from partial ones. Folks familiar with a similar concept in Scala may have an idea of such an operation. Folks familiar with multiple inheritance in C++ can also somewhat relate to this concept.
Before we delve into the topic of mixins, let's understand the following two tree operations, as this is the backdrop against which we will uncover this topic:
- Inorder traversal: As already covered earlier in this chapter, this is a traversal technique in which we visit every node in a given node's left subtree, followed by the node itself, followed by every node in the node's right subtree. This definition is recursive, meaning the exact same sequence of events happens at every node we visit.