Functors

A functor is an object representing a function. As an object, it can be stored in a member variable.

Function Pointers in C++

Functors in C++

Test-It

Problem: Implement the attack behavior of a character as a functor. Here's a start:

FunctorTest.java

Starting with Java 8 lambdas (functors) can be used:

Tournament.java