What is the access modifier of interface
methods? It should be public
or protected
because you have access to them when you implement them (which makes sense). It also should be abstract
because they don't have implementation. But lately I've been reading a book called CLR Via C# and the chapter about interfaces says the following
The CLR requires that
interface
methods be marked asvirtual
. If you do not explicitly mark the method asvirtual
in your source code, the compiler marks the method asvirtual
andsealed
.
When you mark the interface
member virtual
compiler complains that the access modifier in not valid. I mean no access modifier is valid for anything in interface
rather than the default one which is given to them by compiler right? Can anyone make it clear for me?