Difference (last change)
(
Author,
normal page display)
Changed: 2,3c2,3
Protection Attribute of D language is one of "public", "protected", "package","private" and "export".
"export" is used at out of executable, we do not talk about it.
|
Protection Attribute of D language is one of public, protected, package,private and export.
export is used at out of executable, we do not talk about it.
|
General
Protection Attribute of D language is one of
public,
protected,
package,
private and
export.
export is used at out of executable, we do not talk about it.
Remark
Protection Attribute can used in three place according to grammer-diagram: module member, class member and inheriting. But from now on, inheriting attribute is no effort(or does not implement).
For a module:
Proctected Attribute | Other | Package member | Self |
Public/proctected | accessibly | accessibly | accessibly |
Package | -- | accessibly | accessibly |
Private | -- | -- | accessibly |
|
Modules do not inherit, they have no super modules, and offical spec of D language say proctected attribute in module is illegeal, but implement make it an synonym of public.
For a class
Proctected Attribute | Other | Package member | Child | Module member | Nested class | Self |
Public | accessibly accessibly | accessibly | accessibly | accessibly | accessibly | |
proctected | -- | -- | accessibly | accessibly | accessibly | accessibly |
Package | -- | accessibly | -- | accessibly | accessibly | accessibly |
Private | -- | -- | -- | accessibly | accessibly | accessibly |
|
Specially
- class in a module is always public! You can't declare private class or package class.(Strange!)
- Default protected attribute is public, means if protected attribute is absent, public attribute take place.