我有兩個類:一個基類(Animal)和一個從它派生的類(Cat)?;惏粋€虛擬方法Play,它以List作為輸入參數。using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication9{ class Animal { public virtual void Play(List<Animal> animal) { } } class Cat : Animal { public override void Play(List<Animal> animal) { } } class Program { static void Main(string[] args) { Cat cat = new Cat(); cat.Play(new List<Cat>()); } }}當我編譯上面的程序時,出現以下錯誤 錯誤2參數1:無法從“ System.Collections.Generic.List”轉換為“ System.Collections.Generic.List”反正有做到這一點嗎?C# 泛型
- 3 回答
- 0 關注
- 862 瀏覽
添加回答
舉報
0/150
提交
取消