我在两个“输出”处不断收到错误“找不到合适的方法来覆盖”。我将如何解决这个问题?
如何使用数组将数字 4、5 和 6 放在第一句中,将 7 放在第二句中?
这是我到目前为止所做的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication_program
{
public class Numbers
{
public virtual void output()
{
}
}
public class IntegerOne : Numbers
{
public override void output(double o, double tw, double th)
{
one = o;
two = tw;
three = th;
}
}
public class IntegerTwo : Numbers
{
public override void output(double f)
{
four = f;
}
}
class program
{
static void Main(string[] args)
{
Numbers[] chosen = new Numbers[2];
chosen[0] = new IntegerOne(4, 5, 6);
chosen[1] = new IntegerTwo(7);
Console.WriteLine("First number is {0}, second number is {1}, and third number is {2}", ;
Console.WriteLine("Fourth number is {0}", ;
Console.ReadLine();
}
}
}