Definition - What does Protected mean?
Protected is an access modifier that enables the member of a class to be more visible than private but less than public accessibility. The protected members of a base class can be shared only by their descendants, which can override or use them.
Protected modifier helps to implement the concept of encapsulation in C# object-oriented programming. It is mainly used with members of a base class that are re-used in the derived class, which helps to provide centralization of common logic along with rich class hierarchy.
Techopedia explains Protected
For example, BankAccount class represents the account details of a user and can define a method, CalculateInterest, as protected so that any class derived from BankAccount class (such as SavingsAccount, CheckingAccount, etc.) can override the CalculateInterest method with the code necessary to calculate interest based on the type of account.
A protected member cannot be used with a static modifier because it can be accessed only through an instance. A protected modifier cannot be used with members of a struct because inheritance is not supported by struct.
A protected method can be declared with the "virtual" modifier to extend the logic that is necessary to be executed for specialization in the derived class.
Join thousands of others with our weekly newsletter
The 4th Era of IT Infrastructure: Superconverged Systems:
Approaches and Benefits of Network Virtualization:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: