Where can I read more about D's class access m

2019-06-21 23:26发布

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?

1条回答
我想做一个坏孩纸
2楼-- · 2019-06-21 23:56

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

查看更多
登录 后发表回答