class Program
{
public class A
{
private int a1;
public int b1;
internal int c1;
protected int d1;
}
private class A1
{
private int a1;
public int b1;
internal int c1;
protected int d1;
}
internal class A3
{
private int a1;
public int b1;
internal int c1;
protected int d1;
}
protected class A4
{
private int a1;
public int b1;
internal int c1;
protected int d1;
}
static void Main(string[] args)
{
A4 n=new A4();
此时对于对象只能访问类中的public和internal修饰的成员。类成员的修饰类型目的就是针对外部对象对自身的访问。
}
}
</pre><pre name="code" class="html"> internal class A3
{
private int a1;
public int b1;
internal int c1;
protected int d1;
public void GetWorld(A1 m)
{
Console.WriteLine("成员:"+m.b1); //用别的类对象作为参数,就相当于在外部访问类中的成员,只能访问public和internal类型
}
}