Close

Ruby – The “Initialize” method

This is the c# equivalent of the constructur method.

Announcement

I have released my new course on Udemy, Kubernetes By Example. Sign up now to get free lifetime access!

In c# you don’t have to explicitly define the constructor class, because it by default already implicitly specified in every class that you define, however in Ruby you do have to explicitly define it.

Also you invoke the initialize method by calling a special reserved method called “new”

Reference:
http://stackoverflow.com/questions/10383535/in-ruby-whats-the-relationship-between-new-and-initialize-how-to-return-n