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);
}

Buy Me A Coffee

Found this article helpful? Please consider supporting!

Ram
Ram

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity. You can connect with me on Medium, Twitter or LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *