Mixins and Traits
← Back to Composition vs Inheritance
Reusable units of behavior that can be composed into classes without traditional inheritance. Mixins (Ruby, Python) and Traits (Scala, Rust, PHP) provide a middle ground between inheritance and composition, enabling horizontal code reuse.