2 qq 34418970 qq_34418970 于 2016.05.10 22:40 提问

写下一句时gd不能自动生成出现,

public class GoodList : CollectionBase
{
public virtual int Add(T fruit)
{
return InnerList.Add(fruit);
}
public new void RemoveAt(int index)
{
InnerList.RemoveAt(index);
}
public T GetItem(int index)
{
return (T)List[index];
}
public void Set(int index, T fruit)
{
this.RemoveAt(index);
this.Add(fruit);
}
}
public class Program
{
static void Main(string[] args)
{

    Fruti f1 = new Fruti("n1001","苹果","1.5",6);
    Fruti f2 = new Fruti("n1002", "香蕉", "0.4", 4);
    Fruti f3 = new Fruti("n1003", "橘子", "0.5", 10);
    Drink d1 = new Drink("n2001","绿茶","3",2);
    Drink d2 = new Drink("n2002", "红茶", "2.5", 4);
    GoodList gd=new GoodList();

1个回答

silehaixianghuirenj
silehaixianghuirenj   2016.10.08 01:26

时gd不能自动生成出现,
public class GoodList : CollectionBase
{
public virtual int Add(T fruit)
{
return InnerList.Add(fruit);
}
public new void RemoveAt(int index)
{
InnerList.RemoveAt(index);
}
public T GetItem(int index)
{
return (T)List[index];
}
public void Set(int index, T fruit)
{
this.RemoveAt(index);

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!