[英]C# how to add a default implementation to an interface which is overriding another interface
例如:
interface IDottable : IGetDottable
{
bool try_dot_operator(string name);
// ... more methods
IDottable Dottable => this;
}
interface IGetDottable
{
IDottable Dottable {get;}
}
它給了我:
"'IDottable.Dottable' hides inherited member 'IGetDottable.Dottable'. Use the new keyword if hiding was intended.".
嘗試這個:
interface IDottable : IGetDottable
{
bool try_dot_operator(string name);
// ... more methods
IDottable IGetDottable.Dottable => this;
}
interface IGetDottable
{
IDottable Dottable {get;}
}
接口中的默認實現不會公開該方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.