By Team Escalera
on 31 Oct 2017 03:09 PM
  • Protected Access Modifier

A Protected Access modifier is almost like the Private Access Modifier but with
a difference that Protected access modifier can be accessed only from a derived class.

class Human{
protected int Age {get; set;}
protected string Name {get; set;}
class Employee: Human{
public Employe(string nm) {
Name = nm;
public void Speak() {
Console.Write(“Name: “+Name);
static void Main(string[] args) {
Employee e = new Employee(“Rajat”);

//Outputs “Name: Rajat”

Comments (0)

Leave A Comment