用C#语言设计一个程序实现类的继承与多态,要求实现两种不同的方法重载?

来源:百度知道 编辑:UC知道 时间:2024/05/24 18:29:29
代吗少点

using System;

public class A {

public virtual void Display () {

Console.WriteLine("运行时类型:" + this.GetType().ToString());
Console.WriteLine("这是A类的成员函数BaseDisplay().");

}

public virtual void Display (string content) {

Console.WriteLine("运行时类型:" + this.GetType().ToString());
Console.WriteLine("这是A类的成员函数BaseDisplay()的重载.字符串内容为:" + content);

}

}

public class B : A {

public override void Display () {

Console.WriteLine("运行时类型:" + this.GetType().ToString());
Console.WriteLine("这是B类的成员函数Display().");

}

public override void Display (string content) {

Console.WriteLine("运行时类型:" + this.GetType().ToString());
Console.WriteLine("这是B类的成员函数Display()的重载.字符串内容为:" + content);

}

public