Learn Ruby
Class
19.3
Lesson

Biscuit producer class definition

A Biscuit producer produces biscuit. Let’s create a class called Biscuitproducer.

class Biscuitproducer
end

So far we have used Carmaker and Coffeemaker. This one is Biscuitproducer. The class name does not really matter. The important thing is that the class name must start with a capital letter.

Now let’s make a biscuit.

In this case biscuit1 is an instance of class Biscuitproducer.

Let’s go over the class and instance one last time

A class is like a maker, builder or producer. An instance is what is made by using method new. Here biscuit1 is an instance of class Biscuitproducer.