Question #38429

Define an interface. Briefly describe the benefits of using interfaces.

Expert's answer

Answer to question #38429, Programming, C#

Defining an Interface:


interface IMyInterface
{
    void someMethodToImplement();
}


Benefits of using interface:

1. The interface essentially guarantees that all the methods that inherit it will have its methods, so that you can safely call a method in the interface for anything that inherits it.

2. An interface allows you to guarantee that certain methods exist and return the required types.

3. Interface usually encapsulates the smallest amount of logic possible to perform related actions.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS