The following interface has no errors in a .Net Core Console application with C#-8.0
interface I
{
public abstract void f();
public virtual void g() => Console.WriteLine("g");
public sealed void h() => Console.WriteLine("h");
}
abstract
prevents adding a definition in interface. virtual
and sealed
necessitate a definition in interface. sealed
prevents an implementation of h
in derived classes.
Do abstract
, virtual
and sealed
, when used in interfaces, have any other meaning or applications in current implemented version of C# - 8? How and when should they be used in interfaces?