namespace Ex3_16 { class Parent { private int i; protected int j; private void Display() { Console.WriteLine(" 我是父类 "); } protected void Setvalue() { j = 1; i = 4; } public void MyDvalue() { Console.WriteLine("i={0},j={1}", i, j); } } class Child : Parent { public int k; public void Display() { Console.WriteLine(" 我是子类 "); } internal void Change() { Setvalue(); MyDvalue(); } } class Program { static void Main(string[] args) { Parent x = new Parent(); Child y = new Child(); x.MyDvalue(); y.Change(); y.Display(); y.MyDvalue(); y.k = 40; Console.WriteLine("{0}",y.k ); } } }