Why can?t you specify the accessibility modifier for
methods inside the interface?
Answer Posted / karans
All members of an interface is marked as public because :
1) If Private :- The members ca not be implemented into
child class (as private members are derived into child
class).
2). If Protected :- The members can not be accessed by
instance of the class implementing members of that
interface (as protected members become private into
inherited class) even the members will not be inherited
into other child classes of class implementing interface.
c). If Public :- The members can be implemented into
child classes and can be accessed by instances of that
class as well as can be inherited into child class of that
class.
So All the members of Interface are bydefault considered
as PUBLIC.
| Is This Answer Correct ? | 11 Yes | 0 No |
Post New Answer View All Answers
How many types of namespaces available in version4?
Why do we need escape characters?
What is args c#?
What is jagged array in c#?
What is the adv of using System.Text.StringBuilder over System.String?
What are get and set in c#?
Is unity object oriented?
Does c# support properties of array types?
What is an event in c#?
Why do we need static class in c#?
What is ienumerable t in c#?
What is array collection?
What is the use of regex in c#?
Is c# easier than javascript?
Can the accessibility of a type member be greater than the accessibility of its containing type?