How to use C# Interfaces using a Real Example

preview_player
Показать описание
In this video, I show a real example why an INTERFACE could be used.

This of course, is just one example, there are many uses.

Notice, we have two classes, and both inherit the Interface. When you inherit an interface, the class must use all the columns that were defined in the interface.

Think of an interface as a "REQUIRE THESE FIELDS" to the classes that inherit.

I made this video for you. I hope you'll be able to implement what you learned here, without the struggle I went through when I was first learning how to inherit an Interface.

#softwarenuggets
Рекомендации по теме
Комментарии
Автор

Great stuff! I think the PrintList() method you wrote in this example has the syntax I was looking for, I'm going to play around with it to see how I can implement this, and how this can help me avoid unnecessary duplicate code in different classes. Thanks once more for your clear explanation and your time, you're a great help :) I also learned about the 'interface' keyword now; As I was just starting to dip my toes into inheritance, I'll also look into the differences with using an abstract base class next. Truly switching to OO thinking proves to be a challenge, last time I really programmed was with MS professional basic development system 7.x in the early 90's. Soooo I feel quite at home at the UI of the console prototype program I'm writing atm for my assignment :P forms will be next when I got the basics down. So much to learn!

deegeeooh
welcome to shbcf.ru