Santosh Kumar  Kotnala
Why we can not provide access modifer while declaration interface ?
By Santosh Kumar Kotnala in ASP.NET on Feb 10 2011
  • Ashish kandhowa
    Feb, 2011 23

    because they are all public by default

    • 0
  • Felipe Ramos
    Feb, 2011 15

    An interface describes a group of related functionality for a class or structure. They are automatically public and cannot include access modifiers. It is important to note that interfaces can hold properties, events, and indexers also. The interface is always public because it is a contract to be implemented and the implementer decides what access that particular function should have.

    • 0
  • Marcelo Bernart
    Feb, 2011 11

    Because interfaces offer contracts. And the classes MUST implement the interface, so other modifiers could make the contract impossible because of the scope of the class (like internal modifier in different assemblies etc).

    • 0
  • sarika jain
    Feb, 2011 11

    Interface is the standard structure to be followed by the classes where class will implement the functionality and it includes only the declaration of methods,functions and properties.We cannot provide access modifier while declaration of interface bcoz interfaces are public by default and interfaces deals with public members only.

    • 0
  • shaikh shahbaz
    Feb, 2011 11

    Hi Santosh,


    Interface have by default Public access modifier so we need not to defined it .and interface take only public access modifier while declaring it.    

    • 0
  • Deepak Nehe
    Feb, 2011 10

    interface just like the abstract class in interface we only declare the methods not implement it


    so for  implementing the interface  we need acess to all the methods of interface. hence by default the acess modifires for the interface is public



    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS