"Our class cannot handle a double digital as it needs two strikes. Work out a solution that will handle options with multiple parameters".
In one of the earlier posts of the forum, mj mentioned that the "short solution" to this problem is to use an array instead of a double to pass an arbitrary number of parameter. I assume this applies to the PayoffFactory::CreatePayoff(ID,double) and PayoffHelper<T>::Create(double) methods, along with the CreatePayOffFunction function pointer type definition.
However, using an array instead of a double means that an additional constructor, taking an array of doubles as argument, needs to be implemented for each of the classes of the PayOff inheritance hierarchy that have been developed so far in the book. This in order to be compatible with this new representation.
And there are a few of them: call, put, double digital, forward...
Above the fact that we clearly violate the open-closed principle, the solution appears far from short in the end. Is it the right approach, or is there a more elegant way of proceeding with mj's suggestion?
Maybe there is simply something that I've missed.
Thanks for you help in advance.
