private method in interface

Michael Shulman viritrilbia at gmail.com
Fri Jun 3 14:55:14 PDT 2011


On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> And if you don't know about NVI, having a
> virtual private function is just plain weird.

Well, it makes perfect sense to me, once given that in D, 'private'
allows access from anywhere in the same module, rather than only in
the defining class.  I agree that it's weird and surprising in C++.

Are 'package' qualified functions also non-virtual?  The documentation
  http://d-programming-language.org/function.html#virtual-functions
says that "all non-static non-private non-template member functions
are virtual", but I get the same sort of linker errors with 'package'
functions that I do with 'private' ones, even with code that's all in one
module.

Mike


More information about the Digitalmars-d-learn mailing list