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 windows forms in c#?
Why c# is called type safe language?
Can we change static variable value in c#?
Explain the difference between the debug class and trace class?
why delegate is type safe?
What's the difference between abstraction and encapsulation?
what is inheritance and an example in vb.net and c# of when you might use it?
How do I make a dll in c#?
What is the use of xmlserializer?
Is c# lazy thread safe?
What are extender provider components? Explain how to use an extender provider in the project.
How many bytes is an int c#?
What is difference between first and firstordefault?
What is desktop GUI application?
What is the meaning of 0 in c#?