Note that the class definition begins with the keyword class (all lowercase) and the name of the class itself, which must begin with an uppercase letter. The class contains a method set_name. This takes an incoming argument, aName. The body of the method assigns the value of aName to a variable called @myname.
INSTANCE VARIABLES
Variables beginning with the @ character are ‘instance variables’ – that means that they belong to individuals objects – or ‘instances’ of the class. It is not necessary to pre-declare instance variables. I can create instances of the Dog class (that is, ‘dog objects’) by calling the new method. Here I am creating two dog objects (note that while class names begin uppercase letters, object names begin with lowercase letters):