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 abstract class ?

5 Answers   Digital GlobalSoft,


What is type casting. Explain it with reference to classes.

2 Answers   HCL, JPMorgan Chase,


If u declare two interfaces withsame methodnmae .prototype how can u call the particular method from class?

4 Answers   Microsoft,


How do you inherit from a class in C#?

1 Answers  


C# is case sensitive, what is mean by case sensitive

3 Answers  






In a C# class we have a SortedList member m_addinProjects we want to provide an iterator to allow the consumer of this class access to the items in the collection. Please provide an iterator method for the AnalyzeAddinsDLL class below and an example of how it would be used. namespace AnalyzeAddinsDLL { public class AllAddInProjects { private SortedList<string, AddInProject> m_addinProjects; public AllAddInProjects() { m_addinProjects = new SortedList<string, AddInProject>(); } } }

0 Answers   WinsIndia, ABC,


why instance? what are the uses of instance?

3 Answers   Choice Solutions,


What are nullable types? Is Nullable<int> I and int ?i are same.

2 Answers   TCS,


I wish to create a windows application to perform a similar function as that of the "Search" which is provided to look for related files and folders in the System.. What steps must i follow??

0 Answers  


What is the use of "default" and "Using" keyword?

3 Answers   TCS,


ctype(123.34,integer) - should it throw an error? Why or why not?

2 Answers   Wipro,


Can you inherit multiple interfaces?

3 Answers  






Categories