using System;
namespace Test
{
public class Base
{
public void Print()
{
Console.WriteLine(Operate(8, 4));
}
protected virtual int Operate(int x, int y)
{
return x + y;
}
}
}
namespace Test
{
public class Base
{
public void Print()
{
Console.WriteLine(Operate(8, 4));
}
protected virtual int Operate(int x, int y)
{
return x + y;
}
}
}
namespace Test
{
public class OnceChild : Base
{
protected override int Operate(int x, int y)
{
return x - y;
}
}
}
新建实例 OnceChild form=new OnceChild();
form.Operate(3,2);