Join Kevin Skoglund for an in-depth discussion in this video Class attributes, part of Ruby: Classes and Modules.
- [Instructor] In this movie we're going to learn about…class attributes.…Just like class methods, class attributes are going to be…related to a class generally, not to a specific instance,…that's how class attributes are different from instance…attributes that we learned about in the last chapter.…So we're going to store them in the class, not on a specific…instance, what that means is that these class attributes…become shared values among all instances of the class.…Anything that's a member of that class has that same value…and can see that same value.…
It's built-in to the class itself.…Now these are used far less frequently than class methods…are, class methods get used pretty regularly, class…attributes get used much more rarely.…But we do still need to understand them.…The first thing you need to know about class attributes…is going to be how to define a class variable.…We saw instance variables have a single at sign…in front of them, well class variables have a double at sign…in front of them that's how we can differentiate them…
- 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.