阅读下面程序段class Student : Person{ public override string ToString() { return ID + "\t" + Name; } static void Main() { Student s = new Student(); s.ID = 1; s.Name = "JSON"; PromptName(s); } }public class Person{ public int ID { get; set; } public string Name { get; set; } public static void PromptName(T t) where T : Person { Console.WriteLine(t); } }程序运行结果:
选项:
A:1 JSON;
B:Student;
C:Person;
D:出错,约束条件受限
选项:
A:1 JSON;
B:Student;
C:Person;
D:出错,约束条件受限
发布时间:2024-04-25 16:58:01