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
Explain the types of Polymorphism.
What is difference between il and dll ?
Why is it called c sharp?
What is extension method in c# and how to use them?
If you define a user defined data type by using the struct keyword, is it a value type or reference type?
How do I simulate optional parameters to com calls?
Explain inheritance in c#?
Difference between directcast and ctype.
What are Indexers in C#?
How is a loop recorder monitored?
What is null propagation c#?
Why singleton pattern is used in c#?
What is a hashset c#?
Is arraylist type safe in c#?
What is the example of predicate?