Forums » .NET » .NET »

Differnce between internal & protected internal access specifier ?


Posted Date: 19 Feb 2009      Posted By:: venkatesh vadde     Member Level: Silver    Member Rank: 2722     Points: 1   Responses: 2



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?




Responses

#348899    Author: Kartheek Reddy .N       Member Level: Silver      Member Rank: 0     Date: 19/Feb/2009   Rating: 2 out of 52 out of 5     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


 
#348978    Author: Deepthi      Member Level: Bronze      Member Rank: 8152     Date: 19/Feb/2009   Rating: 2 out of 52 out of 5     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



DemoOfProtectedInternal.zip
 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : DatagridViewComboBoxCell problem
Previous : I want T-SQL FAQ. Pls help me
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John

Online Members

Kamal Sharma
More...
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India