Vidyalelo
Ruby Programming · Q16

Object Oriented Programming (OOP) Concepts in Ruby

Programming · Ruby Programming · question 16

Q16

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

A.
To define getter methods for class attributes
Answer
B.
To define setter methods for class attributes
C.
To define both getter and setter methods for class attributes
D.
To define private methods for class attributes

Answer: Option A

Solution

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