Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Why can?t you specify the accessibility modifier for methods
inside the interface?

Answers were Sorted based on User's Feedback



Why can?t you specify the accessibility modifier for methods inside the interface?..

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

Why can?t you specify the accessibility modifier for methods inside the interface?..

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

Why can?t you specify the accessibility modifier for methods inside the interface?..

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

Post New Answer

More C Sharp Interview Questions

What is covariance and contravariance? Did Delegate and method overriding support these?

1 Answers   TCS,


List the difference between interface and abstract class?

0 Answers  


How do you convert byte array to hexadecimal string, and vice versa?

0 Answers  


What is an interface class? Give one example of it

0 Answers  


Helo , Help Me , Help Me About : C# Windows Application - Network How To Manage IP Client's Accessiblity To The Internet Share concise Substitute , Minor ISA Server

0 Answers  


List down the access modifiers available in c#?

0 Answers  


Why is c# a good programming language?

0 Answers  


What language is arduino?

0 Answers  


What is short in c#?

0 Answers  


Is array thread safe c#?

0 Answers  


Trace the O/p for a program on inheritance and Polymorphism. 3 classes A,B,C A with two methods public virtual SomeMethodA public virtual SomemoreMethodA B:A overide SomeMethodA C:B new Method SomeMethodA override SomeMoreMethodA main method { b new instance of B b.SomeMethodA b.SomeMoreMethodA b1 new instance of C b1.SomeMethodA b1.SomeMoreMethodA }

2 Answers   Proteans,


How do you specify a custom attribute for the entire assembly (rather than for a class)?

0 Answers  


Categories