C#如何向覆盖另一个接口的接口添加默认实现
例如:C#如何向覆盖另一个接口的接口添加默认实现,c#,interface,c#-8.0,default-implementation,C#,Interface,C# 8.0,Default Implementation,例如: interface IDottable : IGetDottable { bool try_dot_operator(string name); // ... more methods IDottable Dottable => this; } interface IGetDottable { IDottable Dottable {get;} } 它给了我: "'IDottable.Dottable' hides inherited m
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;}
}
接口中的默认实现不会使方法公开