Using Mixins
This lesson will help you learn about implementing.
We'll cover the following...
Using Mixins
In this lesson, you will learn to use mixins to implement shared behavior(s) without inheritance.
Syntax
The B
is the parent class to A
. The C
is the mixin with methods that B
is interested in implementing.
class A extends B with C {
//Implement methods from B & C
}
The Sketching
behavior is shared between Artist
and Engineer
. Both extend the Person
class. In this case, both Artist
and Engineer
can extend Person
along with mixing shared behavior from Sketching
class using the with
...