C# – simple example of interfaces

After the previous article here for simple example of inheritance, today I have decided to write something similar for interfaces.


Pretty much, interfaces are something similar that objects implement. 🙂 E.g., if you have keyboard and a phone, they both have different buttons. Thus, you may ask for Info() and they would give you some information about the  key. Or you may ask to see how they Multiply a number and the results would be different. Even they both can go in a list of objects, that implement this interface <INumberOfButtons>. Pretty much the following:

This is what you get:



Tagged with: ,