A

Admin • 833K Points
Coach

Q. What is the difference between attr_reader, attr_writer, and attr_accessor in Ruby?

  • (A) attr_reader defines both reader and writer methods, attr_writer defines only reader methods, and attr_accessor defines only writer methods
  • (B) attr_reader defines both reader and writer methods, attr_writer defines only writer methods, and attr_accessor defines only reader methods
  • (C) attr_reader defines only writer methods, attr_writer defines both reader and writer methods, and attr_accessor defines only reader methods
  • (D) attr_reader defines only reader methods, attr_writer defines only writer methods, and attr_accessor defines both
  • Correct Answer - Option(D)
  • Views: 25
  • Filed under category Ruby
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.