From: MenTaLguY Date: 2007-12-14T07:51:55+09:00 Subject: Re: Newbie Question: What is a class for? Very loosely speaking, classes are a way of grouping together functions that work with a particular sort of data structure or object. Functions that have been grouped in a class are often called "methods". Since every object has an associated class, if you have an object, you have explicit access to the functions for working with it. One of the advantages of this is that you can have different functions with the same name, differentiated by the sort of object they work on (this is called "polymorphism"). For example, since we have a Float class and an Integer class, we can define two functions called to_s; one in Float (Float#to_s) that knows how to convert a floating-point number to a string, and one in Integer (Integer#to_s) that knows how to convert an integer to a string. Then you can simply write foo.to_s to get the value of the variable "foo" as a string, regardless of whether it is an Integer or a Float. The class of the object on the left side of the period determines which implementation of #to_s to call. (The object on the left side of the period -- the "receiver" -- shows up inside the called method as "self", btw.) Does that help a bit? -mental