Initializing Objects

Learn how we initialize objects in Ruby.

We'll cover the following

Let’s start over and define a new class.

Remember that objects can be thought of as two things. They know stuff, and they can do things.

Let’s define a Person class. People obviously also know things and can do things.

Here’s how to define a new empty Person class:

class Person
end

Again, that’s not a very useful class, but we can instantiate it and create an actual, concrete person instance (object) from it:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy