Instantiation3:49 with Jason Seifer
In this video, we'll dive deeper in to Classes and how they work. We'll learn about the differences between classes and instances, as well as the process of creating new objects.
Initialize a new string:
Initialize a new string with an argument:
Initialize a new array:
Creating your own initialize method:
class MyClass def initialize puts "This is the initialize method." end end MyClass.new
This will print out the following:
This is the initialize method.
You need to sign up for Treehouse in order to download course files.Sign up