Why do members of an interface don’t have access modifiers?

  • An interface is just a contract for use to the outside world and hence we don't specify any access specifiers to the members of an interface.
  • The members are all public by default.
interface IDope {
  int DoProp {get;set;}
  int DoAdd(int a, int b);
}
  • An interface is just a contract for use to the outside world and hence we don’t specify any access specifiers to the members of an interface.
  • The members are all public by default.
interface IDope {
  int DoProp {get;set;}
  int DoAdd(int a, int b);
}
Default image
Sriram Mannava

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity.

Leave a Reply