Final functions and properties
If you use the final modifier on a function or
a property, the final
modifier prevents a subtype from overriding that item. For example, a
subclass of a Gosu class cannot reimplement a method that the superclass
declares as final.
For example, the following code defines a class with a final function and final properties:
package com.mycompany
class Auto {
// A final property -- no subtype can reimplement or override this property!
final property get Plate() : String
final property set Plate(newPlate : String)
// A final function/method -- no concrete subtype can reimplement or override this function!
final function RegisterWithDMV(registrationURL : String)
}
See also
