Search code examples
daccess-modifiers

Where can I read more about D's class access modifiers?


I can't seem to find a good reference for the D programming language class access modifiers.

I know that public and private are pretty much guaranteed but i'm guessing there are more, i just can't seem to find a good source of information.

Can anyone point me to a good reference please?


Solution

  • You can check the official reference at dlang.org

    in short:

    • private, is only accessible in the same module (file)

    • package, is only accessible in the same package

    • protected, is module + inherited classes

    • public (also the default) is accessible every where

    • export is use to export functions when you are writing libraries