Join Kevin Skoglund for an in-depth discussion in this video Accessing the superclass, part of Ruby Essential Training.
In the last movie we saw how we could override some of the methods that are…subclass inherited from its superclass.…But sometimes we don't want to override the method entirely.…We want to still take in most of that behavior from the parent class, but we…just want to tinker around the edges a little bit.…Well, we can do that, thanks to the keyword Super, and that's how we'll access…the superclass from the subclass.…So I've already got my class Animal that we've been working with and I created a…subclass called Cow.…Let's create another subclass now.…Let's call it subclass Pig.…
That will be subclass of Animal so it will inherit all those behaviors from…Animal, but let's override something inside of it.…Let's say we'll take the noise method that we've been working with.…So it normally just returns noise.…Let's override that.…def noise, and we've seen how to do basic overriding.…Let's say Hello, right, so that's just going to return Hello instead of whatever…the animal's noise is.…Let's go ahead and instantiate it down here.…
- Using Ruby in the Interactive Ruby Shell and in standalone scripts
- Learning to write custom code blocks to find, merge, and sort
- Using modules for namespacing or as mix-ins
- Reading from and writing to files
- Creating a full Ruby project from start to finish
Skill Level Beginner
Q: You mention e-texteditor.com as a place to get a Windows "sister" version of TextMate. However, e-texteditor.com looks like a Chinese auto website. Are there any other alternatives?
1. Getting Started with Ruby
2. Ruby Object Types
3. Control Structures
4. Code Blocks
8. Working with Files
9. Ruby Project: Creating the Food Finder
- 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.