I new to C++ and am learning it for financial applications. In the book that I am reading (C++ for Financial Mathematics), there is a section in which the same function is initialised as public and private within the same class:
class BlackScholesModel {
public: ...other members of BlackScholesModel...
std::vector<double> generateRiskNeutralPricePath(
double toDate,
int nSteps)const;
};
and now it introduces the function generateRiskNeutralPricePath as a private function (with the additional drift parameter):
class BlackScholesModel {
...other members of BlackScholesModel...
std::vector<double> generateRiskNeutralPricePath(
double toDate,
int nSteps,
double drift) const;
}
So, I wanted to know, doesn't the fact that I am introducing the same function twice confuse the compiler? I understand that when I declare the functions, it will be able to differentiate between the two functions (from their parameters). But, is that even a good practice to do? I'd like to think not.