Use function pointers for type erasure.