473,411 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Access Modifiers

Hello

Can anyone provide advice/links on somewhere to get a definitive explanation with Examples of how "protected internal" differs from "protected", "internal" and the other access modifiers

For "protected internal" some places appear to say it means a union of protected AND internal, other places say it's protected OR internal

Thanks

Pet

Nov 15 '05 #1
3 3051
Both the C# Reference and the C# Specification state OR.
The following is an excerpt from the Common Type System, which defines the
rules the IL/Metadata must abide by under the managed environment:

The accessibility domain of a nested member M declared in a type T within a
program P is defined as follows (noting that M might itself be a type):
a.. If the declared accessibility of M is protected internal, the
accessibility domain of M is the intersection of the accessibility domain of
T with the program text of P and the program text of any type derived from T
declared outside P.
-Rob Teixeira [MVP]

"Pete" <an*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
Hello,

Can anyone provide advice/links on somewhere to get a definitive explanation with Examples of how "protected internal" differs from
"protected", "internal" and the other access modifiers.
For "protected internal" some places appear to say it means a union of protected AND internal, other places say it's protected OR internal.
Thanks,

Pete

Nov 15 '05 #2
It's an OR.

From:
http://msdn.microsoft.com/library/de...spec_3_5_1.asp

The MSDN C# Reference.

-----------------

a.. Protected internal (meaning protected or internal), which is selected by
including both a protected and an internal modifier in the member
declaration. The intuitive meaning of protected internal is "access limited
to this program or types derived from the containing class".
-----------------
Also, From the C# Programmers Reference;

"protected internal
[...] Access is limited to the current assembly or types derived from
the containing class."
"Only one access modifier is allowed for a member or type, except for the
protected internal combination."

Hope it helps;

Josh

Microsoft.com Tools

"Pete" <an*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
Hello,

Can anyone provide advice/links on somewhere to get a definitive explanation with Examples of how "protected internal" differs from
"protected", "internal" and the other access modifiers.
For "protected internal" some places appear to say it means a union of protected AND internal, other places say it's protected OR internal.
Thanks,

Pete

Nov 15 '05 #3
For the benefit of us muggles/mortals:
protected internal is a union of protected and internal in terms of
providing access but not restricting.
Meaning
Inherited types, even though they belong to a different assembly, have
access to the protected internal members
Types that reside in the same assembly, even if they are not derived from
the type, also have access to the protected internal members
Sankar Nemani

"Rob Teixeira [MVP]" <RobTeixeira@@msn.com> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
Both the C# Reference and the C# Specification state OR.
The following is an excerpt from the Common Type System, which defines the
rules the IL/Metadata must abide by under the managed environment:

The accessibility domain of a nested member M declared in a type T within a program P is defined as follows (noting that M might itself be a type):
a.. If the declared accessibility of M is protected internal, the
accessibility domain of M is the intersection of the accessibility domain of T with the program text of P and the program text of any type derived from T declared outside P.
-Rob Teixeira [MVP]

"Pete" <an*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
Hello,

Can anyone provide advice/links on somewhere to get a definitive

explanation with Examples of how "protected internal" differs from
"protected", "internal" and the other access modifiers.

For "protected internal" some places appear to say it means a union of

protected AND internal, other places say it's protected OR internal.

Thanks,

Pete


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: kchalla | last post by:
Can anybody let me know the difference between public and private class access modifiers? Thanks in advance
3
by: Ben R. Bolton | last post by:
Is it possible to define a property such that the get accessor is public and the set accessor is private? Ben
2
by: Bob Weiner | last post by:
Is it possible to create a property and specify different access modifiers for the get and set methods? From the property definition it appears that you can define attributes but not access...
4
by: Picho | last post by:
Hi all, Using reflection, I can invoke/call private methods of an object. is this intended? if yes, why? in what scenario (example would be good) should I be givven the option to use...
1
by: Frank | last post by:
I have a form implemented as shown below. If I define the tp_ data member as private it is always null in the Click event handler. When I remove private and let it use the default access ( which I...
3
by: RitualDave | last post by:
This compiles and runs successfully in VS2005: ref class A { private: ~A() { this->!A(); } // private! !A() { } // private! }; ....
2
by: Roy | last post by:
If I define a property as int age { get; set; } Is there a way to add different access modifiers to the accessors when implement?
6
by: Michael Bray | last post by:
I've just inherited a fairly large project with multiple classes. The developer also wrote a huge number of unit tests (using NUnit) to validate that the classes work correctly. However, I don't...
2
by: arunbalait | last post by:
Actually I dont know where to post this question..... Actually this is a OOPS concept...... I want to know what are access modifiers and access specifiers? What are the differences between...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.