Last update November 30, 2005

Proctect Attributes



Difference (previous author) (Change, Edit, normal page display)

Changed: 1c1,24
Describe the new page here.
==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:
[[table]
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
[[table]
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.

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 AttributeOtherPackage memberSelf
Public/proctectedaccessiblyaccessiblyaccessibly
Package--accessiblyaccessibly
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 AttributeOtherPackage memberChildModule memberNested classSelf
Publicaccessibly accessiblyaccessiblyaccessiblyaccessiblyaccessibly 
proctected----accessiblyaccessiblyaccessiblyaccessibly
Package--accessibly--accessiblyaccessiblyaccessibly
Private------accessiblyaccessiblyaccessibly

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.

FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: November 30, 2005 8:05 (diff))