Memorandum (Ruby: Basic Grammar: Classes and Instances)

class

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

instance

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

new method

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

Memorandum (Ruby: Basic Grammar: Classes and Instances)
[Ruby] Classes and instances
Ruby classes and instances
About Ruby classes and instances
Ruby methods and classes (basic)
Creating Ruby classes and instances
Memorandum (Ruby: Basic grammar: Iterative processing)
Classes and instances
Write code using Ruby classes and instances
About classes and instances
ruby memorandum (basic edition)
java (classes and instances)
About the difference between classes and instances in Ruby
Memorandum (Ruby: Basic grammar: Use by naming the process)
About classes and instances (evolution)
Consideration about classes and instances
[Ruby] Singular methods and singular classes
JavaScript overview and basic grammar
Ruby on Rails Basic Memorandum
Review of Ruby basic grammar
[Ruby] Singular methods and singular classes
[Ruby] Creating code using the concept of classes and instances
[Ruby] Classes, instance variables, instances, etc ...
Writing code with classes and instances
Organize classes, instances, and instance variables
Classes and instances Java for beginners
With ruby ● × Game and Othello (basic review)
Introduction to Ruby basic grammar with yakiniku
Java programming (classes and instances, main methods)
Comparison of JavaScript objects and Ruby classes
Getting Started with Java_Chapter 8_About Instances and Classes
Ruby basic terms
I compared classes and instances with worldly things
[Java] Personal summary of classes and methods (basic)
Java basic grammar
Java basic grammar
Java basic grammar
Ruby and Gem
[Ruby] Setting values ​​and memorandum for the table
Java engineers now compare to learn the basic grammar of Ruby Part 2 (classes, methods)
Feel the basic type and reference type easily with ruby
Java classes and instances to understand in the figure
Feel the basic type and reference type easily with ruby 2
About Android basic grammar
Symbols and Destructive Ruby
java classes, instances, objects
HashMap and HashSet classes
Ruby learning points (basic)
[Ruby] Big Decimal and DECIMAL
Ruby Learning # 29 Classes & Objects
ruby basic syntax memo
Ruby inheritance and delegation
Ruby variables and methods
List and happy classes
Basic operators and operations
[For beginners] Explanation of classes, instances, and statics in Java
I tried to summarize the basic grammar of Ruby briefly
The difference between programming with Ruby classes and programming without it