473,320 Members | 2,092 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,320 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 3046
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.