[RUBY] Programming can be a god.

I will write about the fun of programming.

It's where object thinking feels like a god of living things.

An example of that code is below.

class Human

  def walk

  def eat

  def age= num
    if num < 0
      @age = 0
    @age = num



class SuperMan < Human
  def me_kara_beam

human = Human.new
human.walk #ok
human.me_kara_beam #error
spMan = SuperMan.new
spMan.walk #ok
spMan.me_kara_beam #ok

This is because humans can walk, but they can't get a beam out of their eyes. Superman (spMan) can walk and emit a beam from his eyes It is a process called.

I think that programming that seems difficult at first glance may be interesting when viewed in this way.

I've documented my daily learning, so please take a look at it in your spare time. https://www.notion.so/Ruby-Ruby-on-Rails-84f5c88189474fa4aae5e00cba856226

Recommended Posts

Programming can be a god.
Write a class that can be ordered in Java
Create a page control that can be used with RecyclerView
Create a jar file that can be executed in Gradle
Find a Switch statement that can be converted to a Switch expression
OkHttp3 should be a singleton
I made a question that can be used for a technical interview
Mecab installation that can be done almost by typing a command
What is a snippet in programming?
To not be a static uncle
Maybe it can be used at a year-end party? Mosaic game code