Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Web Developer Interviews:BootstrapFront End Web DeveloperHTML DeveloperHybrid Application DeveloperInternee PHP DeveloperJnr PHP/Codeigniter DeveloperJunior Developer PHPLaravel PHP DeveloperPython DeveloperRuby DeveloperTypographyWeb Developer & DesignerWeb Developer Cum SEO AnalystWeb Development NinjasWebsite DeveloperWordPress Themes Developer
Copyright © 2018. All Rights Reserved
Ruby Developer Interview Question:
Tell me can you call a private method outside a Ruby class using its object?
Submitted by: MuhammadYes, with the help of the send method.
Given the class Test:
class Test
private
def method
p "I am a private method"
end
end
We can execute the private method using send:
>> Test.new.send(:method)
"I am a private method"
Submitted by: Muhammad
Given the class Test:
class Test
private
def method
p "I am a private method"
end
end
We can execute the private method using send:
>> Test.new.send(:method)
"I am a private method"
Submitted by: Muhammad
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.