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

what is the need of using interface in program
ex:if we have a program like this
interface1()
{
void method1();
void method();
}
class a1 : interface1
{
a1 b = new b();
b.method1();
b.method2();
}
so without using interface also we can achieve this then
wat is the need to use the interface?
plz give me the answer



Answer Posted / saranya

In a program if multiple classes which has the some common
methods are used,then in that case we will use interfaces.
With the classes you wont left a method without definition
unless that is abstract.Interfaces will help us to provide
different implementations according to user needs.In
interface by default all methods are PUBLIC.But in class by
default it is private.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between struct and class c#?

1043


Explain the difference between abstract class and interface in .net?

957


What is the benefit of dependency injection c#?

956


Can abstract class have constructor in c#?

983


What is AutoMapper in C#?

1033


Is it possible to execute multiple catch block for a single try statement?

1103


Is array a list?

935


Can mvc be used for desktop applications?

1021


what is inheritance and an example in vb.net and c# of when you might use it?

1003


What is sqlcommand in c#?

952


What are the types of inheritance in c#?

1008


What is different about switch statements in c#?

924


How to find whether the application is run from inside ide or not?

1094


What is the difference between ienumerable and enumerator?

962


Why do I get an error (cs1006) when trying to declare a method without specifying a return type?

975