Add missing virtual keyword when inheriting.
Initial work for problem and TwiceDifferentiableFunction support.