What is the difference between calling 'super' and calling 'super()' in Ruby? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 4

What is the difference between calling 'super' and calling 'super()' in Ruby?

10th Nov 2016, 6:22 PM
Jaydeep Khatri
Jaydeep Khatri - avatar
1 Resposta
+ 6
When you callĀ superĀ with no arguments, Ruby sends a message to the parent of the current object, asking it to invoke a method with the same name as where you calledĀ superĀ from, along with the arguments that were passed to that method. While when we useĀ super(), it sends no arguments to the parent.
10th Nov 2016, 7:40 PM
Rebeka Asryan
Rebeka Asryan - avatar