The responsibility of the visibility of a method is relegated to the class that implements the interface.
public interface IMyInterface
{
bool GetMyInfo(string request);
}
In C# set access modifier public, private or protected before the method GetMyInfo() generates the following error: The modifier 'private' is not valid for this item.
Is there a reason you can not define the access modifier on a method or in an interface?
(Question already asked in french here)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…