gpt4 book ai didi

c# - C# 中的泛型继承?

转载 作者:可可西里 更新时间:2023-11-01 08:57:59 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Why cannot C# generics derive from one of the generic type parameters like they can in C++ templates?

我可以

public class MyGenericClass : DL
//but i cannot do
public class MyGenericClass <T> : T

我该怎么做第二个?如果我做不到,我该怎么做

public class MyGenericClass <T> 
{
T obj;
//have all MyGenericClass.XYZ call obj.XYZ
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com