0
In Ruby you can override methods, even "default" language classes. I just wanted to know why the code I did below does not overwrite properly.
class Oi
end
class Ola
def to_s
puts "Olá!"
end
end
oi = Oi.new
ola = Ola.new
puts oi
puts ola
The exit is:
#<Oi:0x000055aa6f9c1bd8> Olá! #<Ola:0x000055aa6f9c1b88> ```
The method to_s
class Ola
had not been superscripted? Why does he print #<Ola:0x000055aa6f9c1b88>
?