What is scope of a Protected Internal member variable of a C# class?
What is scope of a Protected Internal member variable of a C# class?
A protected internal member variable in C# has a scope that combines the access levels of both the protected and internal access modifiers. This means that the variable is accessible within the class where it is declared, any classes derived from that class, and any classes within the same assembly.
Here's a breakdown of the scope of a protected internal member variable:
Within the class: The protected internal member variable can be accessed directly within the class where it is declared.
Derived classes: The variable can be accessed within any classes that inherit from the class where the variable is declared, regardless of the assembly they are in.
Same assembly: The variable can be accessed by any class within the same assembly, even if they are not derived from the class where the variable is declared.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.