Change interface to include the implementations instead of using inheritance.

This solves the problem with virtual template functions.