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...

Y go for Interface? What is use of interface?

Answer Posted / kiran

We will go for an interface when we want to implement a
specific behaviour.

ex:
1.My class x implements IDisposable interface to handle
cleaup operation. I have to implement that behaviour by
implementing the method interface method Dispose()
explicitly in my code.

class x:IDisposable
{}
2.My class y implements IComparable interface to implement
sorting between a list of objects created of type y. Here I
have to implement CompareTo method.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between abstract class and interface.

1096


What are concrete classes?

824


Are c# generics the same as c++ templates?

864


What will a loop recorder show?

905


How to achieve polymorphism in c#?

912


Why we use methods in c#?

889


Where is c# compiler located?

874


Can structs in c# have destructors?

908


What is difference between event and delegate in c#?

864


Why singleton pattern is used in c#?

905


What is difference between method and function in c#?

863


What is the purpose of static?

925


What are the advantages of interface in c#?

889


What does args mean in c#?

839


Why do we use partial class in c#?

823