Classes And Objects In Ruby - Study Mode
[#26] Which method is used to define a class method in Ruby?
Correct Answer
(A) def self.method_name
[#27] What is the keyword used to define a class in Ruby?
Correct Answer
(A) class
[#28] Which keyword is used to create a new instance of a class in Ruby?
Correct Answer
(A) new
[#29] How do you define a constructor in Ruby?
Correct Answer
(A) def initialize
[#30] Which of the following is used to access instance variables in Ruby?
Correct Answer
(A) @variable