ok, let me start with an example.This is my base class in another assembly
namespace BL
{
public class BasicClass
{
protected internal void func()
{
//Code Logic
}
}
}
Now this is my derived class in another assembly
namespace DL
{
public class DerivedClass:BasicClass
{
private void hello()
{
func();
}
}
}
I'm able to call the func()
from base class , hence it shows that the protected
access modifier property but what about the internal
access modifier property.Should it be allowed to access func()
inside another assembly since its declared internal.If so then why call it protected internal
and not simple protected
You might want to give this a read.
The protected internal accessibility level means protected OR internal, not protected AND internal. In other words, a protected internal member can be accessed from any class in the same assembly, including derived classes. To limit accessibility to only derived classes in the same assembly, declare the class itself internal, and declare its members as protected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With