Private versus Protected
Posted by Chuck Hinman on
URL: http://quantlib.414.s1.nabble.com/Private-versus-Protected-tp10688.html
My question is whether there is a good reason for private scope in QuantLib classes. I would like QuantLib to have protected scope rather than private so that developers can inherit the local variables and methods in their subclasses.
In my specific example my financial analyst trusts nothing and always wants to see the intimate details of all calculations to validate correct operation of the classes we use from QuantLib and those classes that we write. We recently wrote a class to calculate the forward volatilities for caps using the CapFloor and BlackCapFloorEngine classes. Since these classes hide important parts in private scope I couldnt inherit from them and display their guts, so I copied the CapFloor and BlackCapFloorEngine classes, changed private to protected, inherited from the copies, and wrote subclasses with methods to save and display the caplet/floorlet values at each iteration and some other intimate details. Copying QuantLib classes and inheriting from them makes me feel like I am doing something foolish and shortsighted.
regards, Charles