Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Ruby On Rails Interview Questions and Answers

Ques. How would you declare and use a constructor in Ruby?
Ans. Constructors are declared via the initialize method and get called when you call on a new object to be created.
Using the code snippet below, calling acts as a constructor for an object of the class Order.

class Order
  def initialize(customer, meal, beverage)
    @customer = customer
    @meal = meal
    @beverage = beverage
Is it helpful? Yes No

Most helpful rated by users:

©2020 WithoutBook