You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
806 B
C#

/*
* C# Program to Illustrate the Use of Access Specifiers
*/
using System;
namespace accessspecifier
{
class Program
{
static void Main(string[] args)
{
two B = new two();
B.show();
}
}
class one
{
private int x;
protected int y;
internal int z;
public int a;
protected internal int b;
}
class two : one
{
public void show()
{
Console.WriteLine("Values are : ");
//x=10;
y = 20;
z = 30;
a = 40;
b = 50;
// Console.WriteLine(+x); // Error x is not accessible
Console.WriteLine(y);
Console.WriteLine(z);
Console.WriteLine(a);
Console.WriteLine(b);
Console.ReadLine();
}
}
}
/*
Values are :
20
30
40
50