This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
In this video, weβll define what traits are in Scala and how to use them. We will create our own traits and show how to inherit multiple traits.
New Terms:
Traits -- In Scala, auxiliary constructors refer to secondary or additional constructors which accept different parameters from the primary constructor. They are defined using βdef this()β and always call either the primary constructor or another previously defined auxiliary constructor.
Further Reading:
Example usage of inheritance
Traits deep dive
Example of how to use Traits
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up