Initializing Objects
Get to learn ho do we initialize and instantiate objects in Ruby!
In the moment of birth
Let’s start over, and define a new class.
Remember how we said that objects can be thought of as two things: They know stuff, and they can do things.
Let’s define a class Person
. People obviously also know things, and can do things.
Here’s how to define a shiny, new, empty class Person
:
class Person
end
Again, that’s not a very useful class, but we can instantiate it, and ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy