Why can?t you specify the accessibility modifier for methods
inside the interface?
Answers were Sorted based on User's Feedback
Answer / tsahi
Interfaces are designed to make sure a class which
implements them exposes a certain set of methods. Because
these methods are exposed, they must be public. therefore,
there is no point in implementing a method from an interface
which will be anything other than public. So all methods in
an interface are always public.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / umesh
They all must be public. Therefore, to prevent you from
getting the false impression that you have any freedom of
choice, you are not allowed to specify any accessibility,
it?s public by default.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / lakshmi
Methods that implement an interface must be declared public. The reason for this is that methods are implicitly public within an interface, so their implementation must also public. Also the return type and signature of the implementing method must match exactly the return type and signature specified in the interface definition.
Is This Answer Correct ? | 0 Yes | 0 No |
how to retrive a TextBox value in to Sql database using C# windows form application coding
Define c# i/o classes?
Where’s global assembly cache located on the system?
Why main is static in c#?
can you create a function in c# which can accept varying number of arguments
What's difference about switch statements in C# ?
Why do we use class in c#?
How does bitwise work?
In .NET how can you solve the DLL Hell problem?
Why we use get and set property in c#?
What is a collection class in c#?
Can you have parameters for static constructors?