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 helper method in c#?

926


what are pointer types in c#

986


Can you declare a field readonly?

942


Does c# have primitives?

890


Is equal in c#?

882


what is IDisposal interface,IComparable,IEquatable,IFormatable

1018


What is a function c#?

974


Can arraylist store different data types in c#?

1006


Why do we need constructor?

921


How can you reference current thread of the method ?

965


Why do I get a syntax error when trying to declare a variable called checked?

1011


What are the main reasons to use c# language?

958


What is difference between first and firstordefault?

914


Explain the types of comments in c#?

918


Why is aws serverless?

882