Using classes and instances for functions