SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Monday, November 3, 2008

Ruby -Object Oriented Language

Ruby is a genuine object-oriented language. Everything you manipulate is an object, and the results of those manipulations are themselves objects.

In Ruby, objects are created by calling a constructor, a special method associated with
a class. The standard constructor is called new.

song1 = Song.new("Ruby Tuesday")
song2 = Song.new("Enveloped in Python")
and so on

These instances are both derived from the same class, but they have unique characteristics.First, every object has a unique object identifier (abbreviated as object ID ). Second, you can define instance variables, variables with values that are unique to each instance. These instance variables hold an object’s state. Each of our songs, for example, will probably have an instance variable that holds the song title.

No comments :

Post a Comment