Reputation:
I'm new to C#, just a question on default access modifier for interface member. We know that the default access modifier for interface is "internal", but why the default access modifier for interface member is "public"? shouldn't it be "internal" so it can be consistent?
Upvotes: 0
Views: 419
Reputation: 2348
Interfaces
declared directly within anamespace
can be declared aspublic
orinternal
and, just likeclasses
andstructs
,interfaces
default tointernal
access. Interface members are alwayspublic
because the purpose of aninterface
is to enable other types to access aclass
orstruct
. No access modifiers can be applied to interface members.
For more information about Access Modifiers (C# Programming Guide) check the following link
Upvotes: 1