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
return first non-zero valueDear All, Suppose that I have this dataset Code: clear input id x 1 . 1 0 1 3 1 4 2 0 2 . 2 0 2 3 …
wild-bootstrap marginal effects with boottestIn response to a query from Jérôme Valette and Sarah Schneider-Strawczynski, I've added an interesti…
Merging problemHi statalist, I have shown a sample of my dataset below. I want to make a merging with the other da…
Diff-in-diff with panel data - Control variablesGood evening! I'm writing an academic paper and I pretend to build a diff-in-diff model using panel …
save results from "test" (wald test) command and combine later with others to create outputI am running several test commands in a row and I would like to save these results and combine them …
Subscribe to:
Post Comments (Atom)
0 Response to Inheritance and virtual functions
Post a Comment