Senior .Net Developer Question: Download Senior .Net Developer PDF

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

Tweet Share WhatsApp

Answer:

☛ 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.

Download Senior .Net Developer PDF Read All 60 Senior .Net Developer Questions
Previous QuestionNext Question
Do you know what is Garbage Collector?Please tell us what is the difference between Override and Overload in a method?