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

Can property be private in c#?

1 Answers  


Which compiler switch creates an xml file from xml comments in the files in an assembly?

1 Answers   Siebel,


What is ildasm and obfuscator in net?

1 Answers  


what optimizations does the c# compiler perform when you use the /optimize+ compiler option?

1 Answers   4Cplus,


What is difference between assembly and namespace?

1 Answers  


What is a type c#?

1 Answers  


what are value types and reference types? where they are stored?

5 Answers   Kanbay,


What do u mean by delegation?

1 Answers  


What are custom exceptions?

1 Answers  


Why is it not a good idea to use empty destructors?

1 Answers  


Is a char?

1 Answers  


What?s the difference between the System.Array.CopyTo() and System.Array.Clone()?

3 Answers  


Categories