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 do we need interfaces?

Answer Posted / shivacharan

Reason1: In C# Multiple inheritence concept will be
implemented by Interfaces.
Reason2: When multiple ppl are working on one sigle
project, if they need to use some common functionality (for
example initializing the variables for thier modules)
instead of writing their own function name (like init,
initialize, setup etc etc) if we can write one single
function name (lets say initialize) then this function can
be implemented by any user who derives. That's it.

public interface IInitialize
{
void InitializeVar();
}
public classs Box:IInitialize
{
void InitializeVar()
{
//initializion of variables goes here
}
public classs Rectangle:IInitialize
{
void InitializeVar()
{
//initializion of variables goes here
}

this wil avoid all the confusion

Is This Answer Correct ?    23 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between directcast and ctype.

960


When should I use static in C#?

938


In object oriented programming, how would you describe encapsulation in c#?

905


1. Describe page life cycle?

2048


What are the benefits of using generics in c#?

862


Contrast between an interface and abstract class?

927


Is python easier than c#?

885


How many destructors can a class have?

978


Is concurrent queue thread safe?

851


Describe two uses of the “using” statement during the operation of c#?

898


Does c# have primitives?

826


State the top.NET class that everything is derived from?

886


Structs are largely redundant in c++. Why does c# have them?

1204


Is list ienumerable c#?

950


Give an example of removing an element from the queue?

887