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
Collapse/aggregate on hourly levelHello everyone, I have a dataset reporting diesel price changes for different petrol stations (stat…
Creating subset in STATADear Madam/Sir, I run the following regression and want to use only observations (77,626) that regr…
Reshaping long to wide problemsHello everyone, I am dealing with a large national database (TQIP) which has a series of variables …
Stata technique for CPPMLHello, does anyone have practical experience in Stata with Constrained Poisson Pseudo Maximum Likel…
Counting Observations in Panel Data and filling in missing valuesHello everyone, I am new to STATA and have a question regarding the preparation of my Data sample. "…
Subscribe to:
Post Comments (Atom)
0 Response to Inheritance and virtual functions
Post a Comment