ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

When to use abstract vs interface?

user-image
تم إضافة السؤال من قبل لطفي عادل صالح ???? , SENIOR ASP.Net MVC DEVELOPER , Abraj
تاريخ النشر: 2016/04/09
mohammed ali
من قبل 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
من قبل 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

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟