Why can?t you specify the accessibility modifier for
methods inside the interface?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / hafiz usman majeed
as by default public access is provided in c-sharp.net
classes and interfaces, and we use interfaces for
accompolishing the purpose of multiple inheritence we must
redefine all of the methods of interface in its inherited
class that implements it so all of these methods should be
publically accessible.
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / ravikiran gullapalli
Then How it can be called as interface,
| Is This Answer Correct ? | 5 Yes | 1 No |
Always the access specifiers for the method in an interface
is public. We cannot implement the methods of interface if
the access specifier is other than public as we will be
left with errors like "members cannot access due to
protection level".
| Is This Answer Correct ? | 3 Yes | 0 No |
What do you mean by delegates and explain different types of delegates?
Does constructor return any value in c#?
How more than one version of an assembly can keep in same place?
What is an int in c#?
How to assign Null value to Var?
About delegates and events?
Which CSS property can be used for controlling the stretchiness of a control?
if you do have a stack overflow profile.what is your ranking?
What does exclamation mark mean c#?
What do you mean by default constructor?
What is activator c#?
What is form feed and carriage return?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)