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





what is the need of using interface in program ex:if we have a program like this interface1() { ..

Answer / 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

More C Sharp Interview Questions

What does args mean in c#?

0 Answers  


What is wrong with the sample program below?

0 Answers  


What is enumerable in c#?

0 Answers  


What is a derived class in c#?

0 Answers  


List down the access modifiers available in c#?

0 Answers  


What is ENUM?

10 Answers   TCS, Wipro, YeshTech,


If you define integer variable and a object variable and a structure then how those will be plotted in memory ?

1 Answers  


what is the difference between int and Int32?

5 Answers   TCS,


why do we use Overloading, Overriding, Boxing, Unboxing, and what is the use of these ?

3 Answers   eXensys,


What does public mean in c#?

0 Answers  


Why do we need properties in c#?

0 Answers  


Explain the OOPS concept in C#?

0 Answers   HCL,


Categories