You must Sign In to post a response.

Differnce between internal & protected internal access specifier ?

mmm...I may be confussed, but this is what I understand...

protected -> the class itself and any inheriting class can access this method or propetry

internal -> ANY class within same assembly can access this method/property, meaning any class within the same VS Project, exe, or dll can access it, whether it's inheriting it or not can get to it

protected internal -> the class itself (where it's declared), the inheriting class(es), and just like internal, it can be access throughout our assemby by any class or part of assembly


based on the above, what is the real need for "protected internal"? If I want a method to be accessible by the base class, all inheriting classes, and throughout the assembly as well, then I can just declare it internal, why dcelare it protected internal? what does it gain me, other than the extra keyword?


Comments

Author: Kartheek Reddy .N 19 Feb 2009 Member Level: Silver   Points : 2

http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/135f6582-7144-496d-a35b-be9ec90f8332/


check this this might help

and I doubt u have already seen it

Kartheek Reddy .N / GGK Technologies Inc – www.ggktech.com

Author: Deepthi19 Feb 2009 Member Level: Bronze   Points : 4

Hi,

Let me Share one single point on this...

What you say is correct, when you are thinking of in one particular Assembly But the scenario changes with multiple assemblies.

Answer to your Point: what is the Need for protected internal?

Let me describe the scenario.

I have a classBase with somemethod which is needed in myAssembly,
and in someclasses of other other Assemblies which inherits the Base class
--> then what is the Access we have for Some Method() in order to access it in MyAssembly and OtherAssemly


Sign In to post your comments