Built-in types
This is the built-in class hierarchy.
- type:-
-
- class
- method
- object:-
-
- integer
- decimal
- boolean
- string
- list
- trigger
- class
- method
- range
There may be additions and/or modifications to this structure in the future (like the addition of a map structure, and templates). The only classes that can be subclassed in this list are object, and all that inherit from object. The other classes are special and can’t be subclassed the normal way (they are subclassed by the compiler).
The classes in this list that inherit from object are known as ‘primitive’ objects. Even though they are in fact objects, they behave in a way that is similar to how native types function in other languages. The fact that by default they autorelease is one of these behaviours.
If you actually want to keep one of these primitive objects past the method it is created in (they are auto released) then you need to retain it.
// want to keep it past this method integer i = 4.retain() // finished with it i.release() // to have two integers pointing to the same object integer i = 5 integer j = i j = 6 // i != 6 // this is correct integer i = 5 integer j = i j.copy(6) // i == 6