Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

When to use abstract vs interface?

user-image
Question ajoutée par لطفي عادل صالح ???? , SENIOR ASP.Net MVC DEVELOPER , Abraj
Date de publication: 2016/04/09
mohammed ali
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?