using System;
namespace Protected_Specifier
{
class access
{
// String Variable declared as protected
protected string name;
protected internal string FirstName;
public void print()
{
Console.WriteLine("\nMy name is " + name);
}
public void print1()
{
Console.WriteLine("\nMy Firstname is " + FirstName);
}
}
class Program : access // Inherit access class
{
static void Main(string[] args)
{
//Program p=new Program();
access a=new access();
Console.Write("Enter your name:\t");
a.name = Console.ReadLine(); //error
a.FirstName = Console.ReadLine();//no error
a.print();
a.print1();
Console.ReadLine();
}
}
}
I have one doubt regarding to inheritance. In this if we use instance of base class it is not working for protected and it is working for protected Internal. Please tell me the reason.....