1.

Explain Ruby object and how to create

Answer»

Object is the default root of all Ruby objects. Ruby objects INHERIT from BasicObject (it is the PARENT class of all classes in Ruby) which allows creating alternate object hierarchie 

Objects in Ruby are created by calling new method of the class. It is a unique type of method and predefined in the Ruby library. 

Ruby objects are INSTANCES of the class. 

  • objectName = className.new 

We have a class named Circle. Syntax to create an object circle : 

  • circle = Circle.new("10") 


Discussion

No Comment Found