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

what is Encapsulation?

7 Answers   IBM, Tech Mahindra,


Write a C# program to find the Factorial of n

0 Answers  


What is the difference between asp net and c#?

0 Answers  


What are delegates?

0 Answers   TCS,


What is the c# equivalent of c++ catch (…), which was a catch-all statement for any possible exception? Does c# support try-catch-finally blocks?

0 Answers  






Is static thread safe?

0 Answers  


Can an exception be thrown from a catch block?

0 Answers   Alcatel-Lucent,


Can a constructor have a return type?

0 Answers  


Overloaded constructor will call default constructor internally?

0 Answers  


What does writeline mean?

0 Answers  


What is the execution entry point for a c# console application?

0 Answers  


How?s method overriding different from overloading?

2 Answers   Visual Soft,


Categories