The functions are parametrized both by the type of Lattice and the type of Option. In the case of lattice we have no choice since Lattice is itself a class template which defines a family of types (parametrized by NodeType) which have no common base type. The type of Option is made a template parameter to gain more flexibility for the various types of Options: the concrete Option classes do not have to implement all the member functions which are used here.
For example the base class Option itself implements nothing and the subclasses of Option which become the actual template parameters can implement these methods selectively to enable selected functionality: lattice pricing or Monte Carlo pricing or both. The function templates are instantiated only at the point of actual use (function call). The compiler then looks for the necessary pieces (here member functions) from the actual template parameters and if all are found the function comes into being otherwise a compiler error results.
This approach provides enormous flexibility. Classes no longer have to conform to well defined interfaces as in a traditional inheritance hierachy. There is a price however: if you want to implement your own Option and Lattice classes and make use of these function templates you will have to read the source code to understand what methods these classes have to provide and how they are used.
Definition in file Pricing.h.
Go to the source code of this file.