Consider the following template class
class MyClassInterface {
public:
virtual double foo(double) = 0;
}
class MyClass
: pub
It is technically *possible** - but it's not practical and it's almost certainly the wrong way to approach the problem.
Is there some reason why P1, P2 and P3 can't be regular integer variables?
*You could embed a C++ compiler and a copy of your source, then compile a dynamic library or shared object that implements your factory function for a given set of P1,P2,P3 - but do you really want to do that? IMO, that's an absolutely crazy thing to be doing.