Answers

Question and Answer:

  Home  Senior .Net Developer

⟩ Do you know what is the difference between an abstract class and an interface?

☛ An abstract class can contain both public and private constructors, methods, and fields. On the contrary, the interface contains only methods and public properties.

☛ You can only inherit from an abstract class, but implement many interfaces.

☛ An interface defines behavior, something that the class that implements it can do. Contrary, an abstract class defines what the class is and what it represents.

☛ You can’t instantiate anyone.

☛ An abstract class is useful when creating components, making a partial initial implementation and a specific definition. This leaves you free to implement other methods.

 155 views

More Questions for you: