Define a common rule for values that is the source of values It is also possible to create individual data while observing common rules Class names start with half-width uppercase letters
class class name
#Definition of variables and methods
end
Data created based on the class It has a reality unlike the class Instance is created by executing new method that can be used by class
The class has a special method called new without defining it
Example:
class Car
end
fire_truck = Car.new #Create an instance of the Car class
puts fire_truck #Output instance
Recommended Posts