Vidyalelo
Ruby Programming · Q18

Object Oriented Programming (OOP) Concepts in Ruby

Programming · Ruby Programming · question 18

Q18

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

A.
To define setter methods for class attributes
Answer
B.
To define getter 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