Given below are two different cases of class definition, and object instantiation in Ruby.
Case 1:
-----------
class Demo
end
p = Demo.new
Case 2:
---------
class Demo2
def initialize(x,y)
@x, @y = x, y
end
end
p = Demo2.initialize(15,20)
What happens when both these cases are executed separately?
Correct Answer:
Case 1 gives no error.
Explanation:
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
More Ruby MCQ Questions