In this program, You will learn how to implement the protected keyword in C#.
public class A {
protected int x = 10;
}
using System;
public class A
{
protected int x = 10;
}
public class B : A
{
public void display()
{
Console.WriteLine("x value is:" + x);
}
public static void Main(string[] args)
{
B t1 = new B();
t1.display();
}
}
x value is:10