What is the difference between calling 'super' and calling 'super()' in Ruby? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
+ 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