difference between keyword internal and protected?
Answer Posted / dotnetasit
The keywords 'internal' and 'protected' are access modifiers.
If any member in a class is qualified with access
modifier 'internal', then it is friend to the current assembly
but not outside of it. This means any member or class(but not
the dervied classes) within the current assembly can access it.
On the other hand, any member qualified with access
modifier 'protected' can be accessed by derived classes only.
I also want to tell about the combined access
modifier 'protected internal'. Any member qualified with
access modifier 'protected internal' is accessible to the
derived classes as well as to any member or class within the
same assembly. So in a way, this combined modifier extends the
scope of 'internal'.
| Is This Answer Correct ? | 25 Yes | 2 No |
Post New Answer View All Answers
What is c# and why it is used for?
Is multilevel inheritance possible in c#?
Illustrate the differences between the system.array.copyto() and system.array.clone()?
What is dataset c#?
What is gridview c#?
What is a thread? What is multithreading?
Can abstract class have constructor?
What is a statement c#?
In .NET which is the smallest unit of execution?
What is the difference between method and function in c#?
What types of object can I throw as exceptions?
List down the differences between public, static and void keywords?
What is a protected class c#?
What is scope c#?
Is goto statement supported in c#?