Access levels

From CSSEMediaWiki
Revision as of 05:44, 30 July 2009 by Michal Connole (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is a brief description of the different access levels available in commonly used languages and what encapsulation boundaries they provide.

Java

* private - Any code in this class
* package - private + any other class in this package (This is the default access level)
* protected  - package + any subclasses
* public - Open access

C#

* private - Any code in this class (or struct)
* protected - private + any subclass
* internal - private + any other class (or struct) in this assembly
* protected internal - private + any subclass + any other class (or struct) in this assembly
* public - open access

C++

* private - Any code in this class
* protected - private + any subclasses
* public - open access

C++ doesn't have a package level access equivalent, but it can give access to others using the 'friend' keyword.

Personal tools