Vidyalelo
Ruby Programming · Q27

Classes and Objects in Ruby

Programming · Ruby Programming · question 27

Q27

What is the purpose of the attr_reader method in Ruby classes?

A.
To create only getter methods for instance variables
Answer
B.
To create only setter methods for instance variables
C.
To create both getter and setter methods for instance variables
D.
To create instance methods

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board