Gosu objects

The root type for all object types in Gosu is the Java class java.lang.Object. An object encapsulates some data as variables and provides properties and methods, which are functions that act on the object. Because java.lang.Object is always in scope, your code uses Object unless a similarly named type is in scope and requires disambiguation.

You can create classes that extend the root object type Object. If you do not declare a new class to extend a specific class, your new class extends the Object class.

Do not use the root object type Object to create objects directly. In some cases, you need to declare a variable that uses the type Object to support a variety of object subclasses. For example, you can define a collection to contain a heterogeneous mix of object types, all of which extend the root object type Object.

var a : Address
var map = new java.util.HashMap()

See also