Answer Posted / 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 View All Answers
if a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
What are the collection types can be used in c#?
Can a class have multiple constructors c#?
Where do we use static class in c#?
Why do we need indexer in c#?
Is for loop faster than foreach?
How do I automate my desktop application?
Are arrays value types or reference types?
List the different stages of a thread?
write code for inserting and updating recoards in sql server database using connected architecture & records shoulds displayed in grid view ( use c# )
What’s thread.sleep() in threading ?
What is datatable in c#?
What is the compiler of c#?
What is the difference between an application domain and a process?
Contrast between an interface and abstract class?