overriding private interface methods

Jonathan M Davis jmdavisProg at gmx.com
Tue Oct 23 13:24:20 PDT 2012


On Tuesday, October 23, 2012 11:47:09 Ali Çehreli wrote:
> private member functions are not virtual by the design of the language.
> You have to make them 'protected', not private.

Yes, but according to TDPL, it's different for interfaces. It specifically talks 
about using private with interfaces for NVI. And I don't believe that you can 
just swap it with protected in the case of interfaces (though I could be wrong 
- I don't remember for sure). Regardless, it doesn't currently work to use 
private like this for interfaces in spite of the fact that TDPL says that you 
can, and I'm not quite sure what's going to happen with that in the future. 
It's clear that private functions in classes will never be virtual, but I'm 
not sure that the situation is as clear with interfaces.

The relevant bug report:

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

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list