• 2021-04-14
    下列代码输出为( ):
    class Father{
    public void F() { Console.Write("A.F"); }
    public virtual void G() { Console.Write("A.G"); }
    }
    class Son: Father{
    new public void F() { Console.Write("B.F"); }
    public override void G() { Console.Write("B.G"); }
    }
    class override_new{
    static void Main() {
    Son b = new Son();
    Father a = b;
    a.F();
    b.F();
    a.G();
    b.G();
    }
    }
  • 举一反三