The only one common thing between abstract class and interface is that you cannot create instance of any of them because both of them are incomplete. There are also few differences between an abstract class and an interface. An abstract class can have implementation of all of its members except abstract members, but an interface
If you want to restrict your fellow team members from creating an instance of a class, you can mark that class abstract using abstract keyword. Abstract class can be used only as a base class. An abstract class may or may not have abstract members. Abstract members can only have declaration and you must use
We know how interface works in C#. But in some cases, we encounter a situation where 2 interfaces have a method of same name and signature. Since your class or structure can inherit from multiple interfaces, there will be ambiguity about which method you want to call. To resolve this issue, we make use of
Interface is an another important pillar of object oriented programming. An interface only contains declaration of its members like properties, methods, delegates, and events, but not fields. Make sure, you should not provide implementation for any of its member inside the interface. To create an interface, we make use of interface keyword. By common naming
We have seen how properties work in C#. To assign values to properties, we create an instance of the class and assign them one by one in every new line. To simplify this process, we make use of Object Initializer. Object Initializer was introduced in C# 3.0 and it will definitely save your a lot