【发布时间】:2014-04-08 14:33:10
【问题描述】:
我有这种情况:
class A<T>
我想要一个 Person 类型的约束,比如
class A<T> where T: Person
我也希望 A 从 B 继承。
示例:
class A<T> : B : where T: Person
或
class A<T> where T: Person, B
我该怎么做?
【问题讨论】:
-
我希望我的编辑是正确的,但是您的原始标题让我感到奇怪。看起来您不是想要“或”,而是想要继承和约束。
标签: c# generics inheritance