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

what is the syntax to inherit from a class in c#?

1067


Explain the difference between // comments, /* */ comments and /// comments?

947


What is the difference between abstract and virtual?

960


What is serialization in c#?

953


Constructor to an arbitrary base constructor?

1033


Why delegates are safe in c#?

920


Explain the various types of classes used in c#?

984


Can You Prevent Your Class From Being Inherited By Another Class?

987


What is a delegate? How can it works?

1221


What is null propagation c#?

1085


What is returned if you pass the value 12.34 to the parsefloat () function?

1010


Can abstract class have parameterized constructor?

970


What is difference between string and string builder?

1021


What is callback delegate in c#?

910


What are the new features in c# 2.0?

1029