package and virtual
Jonathan M Davis
jmdavisProg at gmx.com
Wed Feb 29 17:27:31 PST 2012
On Wednesday, February 29, 2012 17:05:19 H. S. Teoh wrote:
> On Wed, Feb 29, 2012 at 07:53:54PM -0500, Jonathan M Davis wrote:
> > package functions are currenly non-virtual.
> > The spec claims that "all non-static non-private non-template member
> > func tions are virtual," which would mean that package is supposed to
> > be virtual. But from what I recall, the plan is to leave package as
> > non-virtual. So, is that indeed the case and the spec needs to be fixed,
> > or is package going to be made virtual at some point?
> Virtual package functions would be interesting in theory... but I doubt
> there's much practical use for such things. Will packages have an
> inheritance hierarchy now?
The point of allowing virtual package functions would be to allow derived
classes within a package to override the function but disallow it for derived
classes outside of the package. It has nothing to do with adding an
"inheritance hierarchy" to packages (I'm not even sure what you mean be that).
There are similar arguments for making private virtual.
Personally, I'm absolutely fine with package being non-virtual. I'm just trying
to verify that I'm correct in my understanding that the plan is to leave it
non-virtual rather than to make dmd match what the spec currently says and
make package virtual.
- Jonathan M Davis
More information about the Digitalmars-d