Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

When to use abstract vs interface?

user-image
Question added by لطفي عادل صالح ???? , SENIOR ASP.Net MVC DEVELOPER , Abraj
Date Posted: 2016/04/09
mohammed ali
by mohammed ali , System Developer , Millstone

We use abstract class when we know the implementation but we don't know the specifications and we use interface when we know the specifications and don't know about implementation

Khalid Hussain
by Khalid Hussain , Head of Software , TPL Insurance Ltd.

Abstract Class is used when you need to write Abstract and Concrete Methods.

Interfaces have no implementation of methods. They are just blue print of class.

(basically, there are four types of classes (normal, static, sealed and abstractthe abstract class is a class that cant be instantiated, but still can be inherited or inherit from other class unlike the static classhowever, classes such as static and abstract are mainly used to do specified jobs or bunch of codes using it's methods, it's very important when creating a dynamic link library(dll) for codes that are commonly used.And the interface isn't a class type but like a foundation for classes, it defines how a class should be built and how it should work, it's mainly used when you want to avoid the run-time errors due to conflicts between classes and the way it workshope you find this answer useful

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.