interface

Posted by I.veeresh under ASP.NET on 5/9/2008 | Views : 1600 | Status : [Member] | Replies : 4
why we need to use interface?




Responses

Posted by: Lakn2 on: 5/16/2011 [Member] Starter | Points: 25

Up
0
Down
interface is used to define common methods and they should be implemented by derived class. by default interface methods are public no need to give access modifiers.

Thanks&Regards
LakshmiNarayana Nalluri.

I.veeresh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 5/19/2011 [Member] [MVP] Bronze | Points: 25
Posted by: SheoNarayan on: 5/9/2008 [Administrator] HonoraryPlatinum

Up
0
Down
An interface is used to define the contract that should be implemented into the class.

There are several reson to use interface

1. To allow a class to inherit multiple behaviors from multiple interfaces.
2. To avoid name ambiguity between the methods of the different classes as was in the use of multiple inheritance in C++.
3. To combine two or more interfaces such that a class need only implement the combined result.
4. To allow Name hiding. Name hiding is the ability to hide an inherited member name from any code outside the derived class.
5. To define the skelton of the project.


Regards,
Sheo Narayan
http://www.dotnetfunda.com

I.veeresh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 4/18/2009 [Member] Bronze

Up
0
Down
Interface
1 it contains methods and variables.
2 variables may be abstact or final
3 methods must be abstract type.
4 access specifiers must be public.

I.veeresh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response