Y go for Interface? What is use of interface?




Answers were Sorted based on User's Feedback



Y go for Interface? What is use of interface?..

Answer / purushotham .tella

An Interface is a collection of semantically related
abstract members.Used To Support Multiple Inheritance

Is This Answer Correct ?    6 Yes 0 No

Y go for Interface? What is use of interface?..

Answer / venkat2050

interfaces is in concept of late binding which happen at
runtime which a part in OOPs concept
the interface has indexes of abstact
it should in public

Is This Answer Correct ?    4 Yes 2 No

Y go for Interface? What is use of interface?..

Answer / kiran

We will go for an interface when we want to implement a
specific behaviour.

ex:
1.My class x implements IDisposable interface to handle
cleaup operation. I have to implement that behaviour by
implementing the method interface method Dispose()
explicitly in my code.

class x:IDisposable
{}
2.My class y implements IComparable interface to implement
sorting between a list of objects created of type y. Here I
have to implement CompareTo method.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer



More C Sharp Interview Questions

How do you inherit from a class in C#?

1 Answers  


How to make a class not inheritable other than sealed?

3 Answers  


Where is the output of TextWriterTraceListener redirected?

1 Answers  


Can you override private virtual methods?

5 Answers  


How?s method overriding different from overloading?

2 Answers   Visual Soft,






What?s an interface class?

5 Answers   Mind Tree,


What?s an abstract clas?

5 Answers   Mind Tree,


1)what is difference between char and varchar in sql server 2005 2) what is composite key and candidate key 3) what is temporary table and derived table 4) how to calculate difference between two dates

1 Answers   Wipro,


What?s the implicit name of the parameter that gets passed into the class? set method?

1 Answers  


explain DIFFERENCE BETWEEN CLASS AND MODULE?

3 Answers  


Can you prevent your class from being inherited and becoming a base class for some other classes?

3 Answers  


In Main function another function is there and to that function if we pass string as parameter ,then that string value is passed by value or reference type?

4 Answers   Honeywell,






Categories