To C# people: What do you think about this?View other answers to this thread
3.4K+ developers have started their personal blogs on Hashnode in the last one month.
Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more
C# 8.0 introduces a new feature called Default implementations in Interfaces and this changes many things.
Interfaces can now have the default implementation of methods. Interfaces can now have Private members. Interfaces can now have static members, this is used for parameterization of the default implementation. Interfaces can now have protected members which are not accessible by the derived class but can be accessible with a derived interface. If a class wants to implement the protected member, it has to be done by implementing the interface explicitly. Interfaces can also have virtual members, but the class can’t override the method but an interface can.
We can think that Interfaces and abstract are somewhat the same now, But an interface cannot have an Instance state, instance fields, instance auto-properties, cannot define class level fields or variables whereas an abstract class can have state.
There are some reasons stated for this change: Extending APIs, Interoperability with Android, iOS, and supporting the traits language feature.