Difference between Internal, Protected and Protected Internal

 Protected Member
 
 Protected Member of a class in only available in the contained class (in which it has been declared) and in the derived class within the  assembly and also outside the assembly.
 
 Means if a class that resides outside the assembly can use the protected member of the other assembly by inherited that class only.
 
 We can exposed the Protected member outside the assembly by inherited that class and use it in the derived class only.

 Note: Protected members are not accessible using the object in the derived class.
 
 
 Internal Member

 
 Internal Member of a class is available or access within the assembly either creating object or in a derived class or you can say it is  accessible across all the classes within the assembly.
 
 Note: Internal members not accessible outside the assembly either using object creating or in a derived class.
 
 
 Protected Internal
 
 Protected Internal access modifier is combination Protected or Internal.
 
 Protected Internal Member can be available within the
entire assembly in which it declared either creating object or by inherited that  class. And can be accessible outside the assembly in a derived class only.
 
 Note: Protected Internal member works as Internal within the same assembly and works as Protected for outside the assembly.
Ebook Download
View all
FileInfo in C#
Read by 9.7k people
Download Now!
Learn
View all