[Issue 3258] Calling private or package override methods calls the base implementation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 22 03:57:06 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=3258



--- Comment #13 from Stewart Gordon <smjg at iname.com> 2012-12-22 03:56:58 PST ---
(In reply to comment #12)
> For the problem at hand though, without causing a lot of breakage, 
> that means either private/package become virtual by default, 
> private/package can never be virtual, or a 'virtual' (or 
> 'overridable') keyword is introduced.  In theory I agree with 
> Andrej, but would probably vote that handling all protection 
> methods in the same way is preferable.

At the moment, we have final, which is roughly the negation of virtual.

> In an ideal world though, I think I'd choose to make overriding 
> explicit and shadowing illegal: i.e.  unless 'virtual'/'override' 
> is specified names must not clash with those from a base class.

I agree that it would be a way forward to kill overriding without the override
attribute once and for all.  Once this is done, we can implement this
principle:

- If a private symbol is redeclared in a subclass in the same module, it must
have the override attribute, and it overrides the superclass method.

- If a private symbol is redeclared in a subclass in a different module, it
must not have the override attribute, and the two are distinct symbols with no
relation to each other.  Basically, the subclass has no knowledge of the
superclass's private members (as it should be).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list