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


Please Help Members By Posting Answers For Below Questions

What is a variable in c#?

467


What is the purpose of abstract class in c#?

487


Is multilevel inheritance possible in c#?

474


Explain different properties of object oriented systems.

439


what are the different ways a method can be overloaded?

518






Explain the three test cases in unit testing?

591


What do you mean by generic class in c#?

489


What is the difference between system.string and system.text.stringbuilder classes?

514


What is the use of the dispose method in C# ?

539


How can you set image source dynamically from c# application to ”test.png” file?

634


What does the parsefloat function do?

482


Define delegate?

537


How do you set a class path?

441


What is reflection in c#?

489


Define an assembly in .net?

515