hi friends
I want to know about the specification of accessibility modifier for methods inside the interface ?
thanks ....
Specification of accessibility modifier for methods
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted May 16, 2012, 8:57 AM EDT
However, all interface members are explicitly public and so a class (or struct) which implements the interface must provide public implementations of those members.
The only exception to this is if the member is implemented 'explicitly' (i.e. it can only be accessed via an interface reference) in which case no access modifiers are permitted.
For example:
interface IFace
{
void MyMethod();
void YourMethod();
}
class MyClass : IFace
{
public void MyMethod(){}
void IFace.YourMethod(){} // implemented explicitly
}
SenthilkumarRank #387 · 6.5K reputationPosted May 17, 2012, 3:21 AM EDT
As you know the interface can't be instantiated directly, so it needs to be inherited. which means it is default should have some access modifier. It should be public.