Tell me can you call a private method outside a ruby class using its object?



Tell me can you call a private method outside a ruby class using its object?..

Answer / Manoj Kumar Rajput

Private methods in Ruby are not accessible outside of the class where they are defined. You cannot directly call a private method on an instance from outside the class. However, there are some workarounds such as using singleton classes or module functions.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby Interview Questions

Explain about class libraries in ruby?

1 Answers  


Is ruby supports single inheritance/ multiple inheritance or both?

1 Answers  


Explain about the command line options?

1 Answers  


How many types of associations relationships does a model has?

1 Answers  


Explain Ruby exceptions?

1 Answers  


What method might you use to remove duplicate values from an array?

1 Answers  


Tell me how you define instance variable, global variable and class variable in ruby?

1 Answers  


What is mvc? And how it works?

1 Answers  


What is rvm?

1 Answers  


Tell me what are blocks and procs?

1 Answers  


How do the following methods differ: @my_string.strip and @my_string.strip! ?

1 Answers  


What is the pattern matching operator in ruby?

1 Answers  


Categories