Last update November 30, 2005

Proctect Attributes



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 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))