12.3. Overrides

Implementations are great, but what happens if you need to call the parent class implementation of a method? In Java, you would use a super reference, but Golo does not provide that.

Instead, you can override methods, and have the parent class implementation given to you as a method handle parameter:

let conf = map[
  ["overrides", map[
    ["toString", |super, this| -> ">>> " + super(this)]
  ]]
]
println(AdapterFabric(): maker(conf): newInstance(): toString()) # (1)

(1)

This prints something like: >>> $Golo$Adapter$0@12fc7ceb.

Note

You can mix both implementations and overrides in an adapter configuration.