- [Narrator] In this movie,…we're going to learn about another use for modules…that's very different from what we were doing…with namespacing.…This is called mixins.…Mixins are a necessary tool in Ruby,…because Ruby only allows subclasses to inherit…from one superclass.…Think about that for a moment when we had our pig subclass,…it inherited from the animal superclass, the parent.…They can only have one parent.…There are a couple of programming languages…that let you inherit from more than one superclass,…but it's pretty rare.…Most of the time,…subclasses have only one parent superclass.…
What modules do is they allow us…to package up shared functionality…so that we can then use them in a class…without having to inherit from it.…Modules are mixed in to a class.…That's why we call them mixins.…It's kind of like having a class fragment…and it's another way that we're able to not repeat ourselves…as we're coding.…Let's look at an example.…Let's imagine that I have a class called Person,…and it has some behaviors.…It has a first name and a last name,…
- Defining a custom class
- Working with instances of a class
- Class and instance attributes and methods
- Class inheritance
- Working with dates and times
- Using modules as namespaces and mixins
- Raising and handling exceptions
Skill Level Beginner
2. Class Attributes and Methods
4. Dates and Times
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.