Returns a string representation of this object. For most objects this is the class name, but for numbers and strings this is a number or a string instead.

This method is automatically called when an object is converted to a string. So you can override this method to change what this object would turn into during the addition of this object to a string.

/* An example of overriding the toString method */

class Person
    def new( name, surname )
        @name = name
        @surname = surname
    def toString()
        return "Hi, I'm " + @name + ' ' + @surname

// Outputs "Hi, I'm Brian Jones" on the console
person = new Person( "Brian", "Jones" )
console( person )