private/package methods cannot be virtual

Jonathan M Davis jmdavisProg at gmx.com
Mon May 6 15:24:45 PDT 2013


On Monday, May 06, 2013 21:05:03 deadalnix wrote:
> If it is private, by definition, the compiler have all override
> available. So it can finalize automatically.

Not with the current spec. As it stands, private is not hidden, merely 
inaccessible. So, if private were to become virtual, derived classes in other 
libraries could override it. That's how it works in C++.

Now, quite a few of us would like private to become hidden from overload sets 
(which would then make it so that what you suggest could work) and make it so 
that nothing outside the module could override it even if it were virtual, but 
that's not how it is now.

- Jonathan M Davis


More information about the Digitalmars-d mailing list