Join Kevin Skoglund for an in-depth discussion in this video Attributes, part of Ruby: Classes and Modules.
- [Instructor] Now that we know how to define the class…and how to create an instance from that definition,…we're ready to talk more about attributes.…Attributes are the values that persist…inside an instance of a class.…When we looked at our example…with the While You Were Out notepad,…we created a different instance…each time we ripped off one of those pages.…The attributes are the blanks that you fill in…inside each instance.…They're what makes it unique,…or allows it to maintain its state.…We might have one message that's from Bob,…while another one is from Lucy.…
Each of those would be values assigned to an attribute.…You can also think of attributes…as being the properties of an object.…In some programming languages,…they're actually called properties,…but in Ruby, we call them attributes.…In the real world, we know about properties,…the car is green.…Green is a property that defines…what makes this car unique from other cars.…The house has three bedrooms and two bathrooms.…Inside our instances, we're going to store these values…
- 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.