Parametric constructor with function pointer.