Join Kevin Skoglund for an in-depth discussion in this video Method access control, part of Ruby: Classes and Modules.
- [Instructor] In this movie,…we're going to learn about method access control.…We've already seen that methods…are the primary interfaces to a class.…For example, in the last few movies,…we were able to see that you can't…access instance variables from outside of the instance.…Only inside the code are we able to access them directly.…Otherwise, we have to use a method.…That's why we had those reader and writer methods…is because methods provide an interface…to the instance variables.…But we only want to expose interfaces when necessary,…so we need to have some level of control over them,…and that's where access control comes in.…
It restricts access to methods from outside an instance.…It decides what methods are callable and what ones aren't.…There are three levels of method access control.…There's public, and that's the default.…That's where anyone can access the method.…That's what we've been seeing so far…where we just have an instance of something,…and we call dot and then the method name after it.…We're able to call that method.…
- 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.