[RAILS] [Ruby] Relationship between parent class and child class. The relationship between a class and an instance.

A memorandum of beginners.

I was a little confused about the relationship between the parent class and the child class, and the relationship between the class and the instance.

All four are objects, and objects are concepts that include classes.

○ Relationship between class and instance -Based on the class, an "object" called an instance is created. -Methods defined in the class can be called like "instance.method". -Instance variables defined in a class, such as @ 〇〇〇, can also be called in an instance.

○ Relationship between parent class and child class -A new "class" called a child class is created based on the parent class. -In the child class, the method defined in the parent class can be changed by defining the method with the same name (override).

Recommended Posts

[Ruby] Relationship between parent class and child class. The relationship between a class and an instance.
Easy to understand the difference between Ruby instance method and class method.
Ruby: Differences between class methods and instance methods, class variables and instance variables
What is the difference between a class and a struct? ?? ??
Difference between class and instance
[Ruby] Difference between methods with and without self in the class. About class methods and instance methods.
Relationship between package and class
[Ruby] Does self refer to a class or an instance?
What is the difference between an action and an instance method?
[Java] A class is an OS, and an instance is a virtual computer.
Difference between instance method and class method
Difference between instance variable and class variable
[Ruby] Difference between symbol variables and character string variables. About the difference between [: a] and ['a'].
[Java] Introductory structure Class definition Relationship between class and instance Method definition format
What is the difference between a web server and an application server?
Difference between Ruby instance variable and local variable
[Java] Differences between instance variables and class variables
Interpret the relationship between Java methods and arguments into a biochemical formula
How to check if an instance variable is defined in a Ruby class
Let's explain the difference between an interpreter and a compiler using a Venn diagram
Call a method of the parent class by explicitly specifying the name in Ruby
[Ruby] I thought about the difference between each_with_index and each.with_index
About the difference between classes and instances in Ruby
Calculate the difference between numbers in a Ruby array
About the relationship between HTTP methods, actions and CRUD
[Ruby / Rails] Set a unique (unique) value in the class
Verification of the relationship between Docker images and containers
[Ruby] Class nesting, inheritance, and the basics of self
[Java] Precautions when referencing a reference type in a parent class and instantiating it in a child class
About the difference between "(double quotation)" and "single quotation" in Ruby
The nth and n + 1st characters of a Ruby string
[Ruby] About the difference between 2 dots and 3 dots of range object.
The difference between programming with Ruby classes and programming without it
[Self-use memo] (Ruby) class, class instance, instance
Difference between variables and instance variables
Relationship between Controller and View
[Ruby] What is an instance?
[Ruby] Class methods, instance methods, etc.
I made a Ruby container image and moved the Lambda function
[Ruby] Maybe you don't really understand? [Difference between class and module]
The relationship between strict Java date checking and daylight savings time
About the relationship between the Java String equality operator (==) and initialization. Beginners
Create a calendar from the Calendar class by specifying the year and month
[Ruby] Difference between get and post
Difference between interface and abstract class
Relationship between ActiveRecord with_lock and cache
[Ruby] Difference between is_a? And instance_of?
Understand the difference between each_with_index and each.with_index
Relationship between database and model (basic)
[Java] Relationship between H2DB and JDBC
A murmur about the utility class
Differences between Applet class and JApplet class
A nice workaround when "having an instance of either of the two classes"
A note on the differences between interfaces and abstract classes in Java
[Ruby] Processing with multiple colons. A class that utilizes the module namespace.
Get a rough idea of the differences between protocols, classes and structs!
Organize the relationship between SLF4J, Logback, and Log4J along with their behavior
Deploy a Node.js application to an ECS instance using the Cloud Toolkit
[Ruby] I want to make an array from a character string with the split method. And vice versa.
When reassigning to an argument in a Ruby method and then calling `super` → The reassigned one is used