but in constructing a curve (using the PiecewiseYieldCurve) we use a factory class function (interpolator_.interpolate) to allocate an Interpolation object to the interpolation_ member variable. However, often the object allocated is an object of a derived class e.g. CubicSpline.
Now, I know pointers and references can be polymorphic. But in this case a derived class is being allocated to a base class instance...
I know most information required for interpolation is contained within the Interpolation::impl_ object but I'm wondering whether:
a) my C++ knowledge is lacking and the base class instance (e.g. ForwardCurve::interpolation_) can be polymorphic somehow. Or...
b) why a pointer to the derived Interpolation object isn't returned by the factory class (e.g. Cubic::interpolate) - to obviate the need for a polymorphic Interpolation::impl_ member variable?
Thanks in advance for enlightening me.
Simon
Free forum by Nabble | Disable Popup Ads | Edit this page |