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!!!
Related Posts with Inheritance and virtual functions
Replace missing values that are indicated with an asterisk (*)I have a problem regarding an Excel file that has missing values that are indicated with an asterisk…
OECD data - variables of interest are all in one variableI doubt I am the first person to run into this issue, but when you pull time-series data from the OE…
Non-numeric String variableHi All, I am new to Stata and getting hands on it by using the data. I have cross sectional data fo…
Gradient colored scatterplotHello everyone, I am trying to make a scatter plot using the plottig scheme (or any scheme for that…
Potential Serial-correlation in a FE Panel ModelHi Statalist! Any advice on the below, would be very much appreciated! We have a fixed effects mod…
Subscribe to:
Post Comments (Atom)
0 Response to Inheritance and virtual functions
Post a Comment