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

What is a statement c#?

985


how to print invert pyramid in c#

1767


What is default method in c#?

1024


What are the steps to make an assembly to public?

984


What does string intern do?

1033


What are native functions?

867


Explain About friend and Protected friend

901


What are the boolean data types in c#?

1015


Which programming language is best for desktop applications?

937


What are the advantages of generics in c#?

906


What is definition in c#?

872


What is a race condition?

899


Distinguish between system.string and system.text.stringbuilder classes?

933


Is arraylist thread safe?

873


What do you mean by for each loop?

922