Hi everyone,
my question is in the use of virtual functions and they are actually two questions:
1.- Do we have to re-declare the function in the subclass that is actually going to implement the function?
2.- Whether we do or not, does the function in the subclass have a particular level of exposure: public or private?
The way I understand virtual functions is that they are useful to declare a functionality that subclasses should have, and the type of object they should return. For example if you’re programming maximum likelihood estimators, you could have the super class MLEstimator where you define all the functions that a particular estimator must implement, like MLEval, for the evaluator, Estimate, Display, etc... However, if they force a particular exposure level to the function when implemented it can be troubling. For example, I may want Estimate to be public, and to call Display from inside Estimate and, thus, to be private.
Thanks!!!
0 Response to Inheritance and virtual functions
Post a Comment