What think do you can sayme about interface in C#? It's confuse for me respect abstracta | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What think do you can sayme about interface in C#? It's confuse for me respect abstracta

Interface

11th Feb 2020, 8:48 PM
Digitofer
4 Answers
+ 3
A class can inherit from just one base class, but it can implement multiple interfaces. Therefore, by using interfaces you can include behavior from multiple sources in a class.
11th Feb 2020, 9:36 PM
JaScript
JaScript - avatar
+ 3
They provide a way to implement multiple behaviours without using multiple inheritance directly.
11th Feb 2020, 11:25 PM
Sonic
Sonic - avatar
+ 2
I do find interfaces a really difficult topic. Although I am very happy with the defined interfaces like IEnumerable, IDisposable, IComparable. They make live a lot easier. In need to admit, I use there functionality the most in already defined types. But it is good to be aware of the fact that it is a interface that you are using. A interface is a contract. A description of the name of the method, its returns value and the parameters.
11th Feb 2020, 10:07 PM
sneeze
sneeze - avatar
0
Abstract class is a class with implementation and can not have an instance from it. every class can inherit from just one class Interfaces have not any implementation and they made for multiple inheritance and fix multiple inheritance problem You can have unlimited interface inherited Why interface and not class: Interface fix function of method and constructor problem if two class inherited from one same class create loosely coupled software support design by contract (an implementor must provide the entire interface) allow for pluggable software allow different objects to interact easily hide implementation details of classes from each other facilitate reuse of software
12th Feb 2020, 4:38 AM
Artemis Ariamehr
Artemis Ariamehr - avatar