Define a new class using the class keyword.
class
Instantiate instances of the class with the class constructor new.
new
Add instance methods to your class with def in the body of the class.
def
Set instance variables through writer instance methods.
Identify the scope of an instance variable.
Read an instance variable through a reader instance method.
Use attr_accessor to define reader and writer methods for attributes.
attr_accessor
Hook into an object's instantiation with #initialize.
#initialize
<iframe width="100%" height="720" src="https://www.youtube.com/embed/UysgBTrJoTc?rel=0&showinfo=0arrow-up-right" frameborder="0" allowfullscreen></iframe>
Direct link to MP4.arrow-up-right
This video is meant to be a review of the first few topics in Object Orientation in Ruby.
View Intro to Object Orientation - Ruby - Review Lecturearrow-up-right on Learn.co and start learning to code for free.
Last updated 6 years ago