Modifiers and interfaces

In many ways, interfaces are defined like classes. One way in which they are similar is the support for modifier keywords.

One notable difference for interfaces is that the abstract modifier is implicit for the interface itself and all methods defined on the interface. Consequently, Gosu does not support the final modifier on the interface or its members.

Implementing methods

Use of the override modifier is optional on an implementation of an interface method. If you do use the override modifier, your code in a class that implements an interface is more robust against changes in method signatures in the interface.

Superclass properties

When implementing an interface and referencing a property on a superclass, use the super.PropertyName syntax, such as:

property get WholeValue() : String {
  _mySpecialPrivateVar = super.FirstHalf + super.SecondHalf
}

See also