簡體   English   中英

在通用類上添加繼承類

[英]Add inherit class on Generic Class

我有這樣的通用類:

public class MyClass<T> 
    where T : class
{
    // method in here...
}

我嘗試使該類繼承自另一個類,如下所示:

public class MyClass<T> 
    where T : class
    : BaseMyClass
{
    // method in here...
}

但這沒用。

是否可以從其他類派生通用類? 以及如何做到這一點?

public class MyClass<T> : BaseMyClass where T : class
{
    // method in here...
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM