using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BClassD
{
class Program
{
public class A
{
private int priv=20;
protected int prot=30;
public void Show()
{
Console.WriteLine("private={0}protected={1}", priv, prot);
Console.WriteLine("父类内容");
}
}
public class B : A
{
public void Shownew()
{
//priv = 40;
prot = 50;
Console.WriteLine("prot:{0}",prot);
Console.WriteLine("子类内容");
}
}
static void Main(string[] args)
{
B b = new B();
b.Show();
b.Shownew();
b.Show();//在继承类中改变变量的值,父类中该变量的值也会改变,同一块内存
Console.ReadKey();
}
}
}