Connect a function to a button created in an object (ControlP5)

http://www.Sojamo.de/libraries/controlP5/reference/controlP5/Controller.html#plugTo-java.lang.Object-java.lang.String-

// https://Discourse.processing.org/t/
// connect-a-function-to-a-button-created-in-an-object-controlp5/1821/7

// https://GitHub.com/sojamo/controlp5/blob/master/examples/extra/
// ControlP5ControllerInsideClass/ControlP5ControllerInsideClass.pde

// GoToLoop (2018/Jul/16)

import controlP5.ControlP5;

ControlP5 cp5;
Interface i;

void setup() {
  size(300, 200);
  i = new Interface(cp5 = new ControlP5(this));
}

void draw() {
  background(050);
}

class Interface {
  final ControlP5 cp5;

  Interface(final ControlP5 controlP5) {
    (cp5 = controlP5).addButton(getClass().getSimpleName())
      .setPosition(10, 10)
      .setSize(50, 20)
      .plugTo(this, "gotClicked");
  }

  void gotClicked() {
    println("You've clicked at me!");
  }
}