About Go, D module naming

Jonathan M Davis jmdavisProg at gmx.com
Sun Dec 23 12:58:45 PST 2012


On Sunday, December 23, 2012 21:47:13 Phil Lavoie wrote:
> Ok so it's the feature that allows you to write something like
> myObject.notInClassDeclarationMethod( zeParam );
> Which is awesome.
> 
> I'd like to know if there is any functionality provided by having
> private functions/methods being visible? Does it mean you can
> override them in your module (for module scope privates)?

private is _always_ module scope.

Regardless can't override private functions even within a module, because in 
D, private and package functions are never virtual and therefore cannot be 
overridden. If you want to be able to override them, you have to make them 
public or protected.

In C++, you can make private functions virtual and override them, but that's 
not possible in D, primarily because we took the simpler route of tying the 
virtuality of a function to its access level rather than having to explicitly 
mark functions as virtual.

- Jonathan M Davis


More information about the Digitalmars-d mailing list