ALERT

[FREE DEMO] Deploy Your Enterprise Cloud in Minutes

Inaccessible Member

Definition - What does Inaccessible Member mean?

An inaccessible member, in the context of C#, is a member that cannot be accessed by a specific type. An inaccessible member that cannot be accessed by one type can be accessible by another type.

An inaccessible member may obtain the accessibility level that controls its usage from other code in the assembly in which it is declared, or from other assemblies.

A member of a type is designed to be inaccessible from certain types for the purpose of encapsulation. Encapsulation of data helps to protect data within the object from accidental corruption as well as hiding unnecessary implementation details from the object's user.

Techopedia explains Inaccessible Member

The accessibility of a member of a type is determined by the type in which it resides and the access modifier specified to it during its declaration. The following are the access modifiers used to specify accessibility:

  • Public: Access to both the current assembly and an external assembly that references it.
  • Private: Access is limited to the containing type.
  • Protected: Access is limited to the containing class or types derived from the containing type.
  • Internal: Access is limited to current assembly only.
  • Protected internal: Access is limited to current assembly or to the types derived from the containing class.

For example, a type can be declared with a method that has a protected modifier so that it is inaccessible outside the class but accessible to its derived classes.

Not all access modifiers can be used in all contexts by all types. When a member of a type does not include an access modifier during its declaration, its default accessibility is private.

As per the accessibility constraint in C#, several constructs require a type to be at least as accessible as a member or another type. Additionally, if the member is a method, delegate, or indexer, the return type and parameter types must be at least as accessible as the member itself. Use of an inaccessible member will result in a compile time error.

This definition was written in the context of C#

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
Tweat cdn.techopedia.com
"Techopedia" on Twitter


'@Techopedia'
Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Resources
The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.