#303 – Accessibility of Class Members

Members of a class can have different kinds of accessibility.  An accessibility keyword indicates what source code can access the member.  The different types of accessibility are:

Accessibility Keyword Description
public All code can access the member
private Only other code in the class can access the member
protected Code in this class or any class that inherits from this class can access
internal Code in files in the same assembly (.dll or .exe) can access
protected internal Code in the same assembly or in classes that inherit from this class can access

Accessibility keywords can apply to the following kinds of members of a class: fields, properties, methods, constants, indexers, events, constructors and nested types.  They can apply to both instance and static members.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

9 Responses to #303 – Accessibility of Class Members

  1. Pingback: #310 – Accessibility of Fields in a Class « 2,000 Things You Should Know About C#

  2. Pingback: #310 – Accessibility of Fields in a Class « 2,000 Things You Should Know About C#

  3. Pingback: #311 – Accessibility of Properties in a Class « 2,000 Things You Should Know About C#

  4. Pingback: #312 – Accessibility of Methods in a Class « 2,000 Things You Should Know About C#

  5. Pingback: #315 – Accessibility of Static Methods and Properties « 2,000 Things You Should Know About C#

  6. Pingback: #321 – Accessibility of Constants « 2,000 Things You Should Know About C#

  7. Pingback: #322 – Class Accessibility « 2,000 Things You Should Know About C#

  8. Pingback: #697 – Encapsulation is Managed through the Use of Access Modifiers « 2,000 Things You Should Know About C#

  9. Pingback: #698 – Type Members Are Implicitly Private « 2,000 Things You Should Know About C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: