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

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

متابعة

Can you give some real time example where you have used an interface and abstract class in C#?

user-image
تم إضافة السؤال من قبل Mohammad Abdullah , Software Developer , Ducatindia pvt Ltd
تاريخ النشر: 2016/01/22
Maher Alsilwy
من قبل Maher Alsilwy , CONSULTANT , B7R DESIGN WWW.B7RDES.COM

in companies, for example, when there are different teams working on a particular project, then you for example will develop a class, test it, make it abstract class, then you will hand it over to the other team.

Ibrahim Magdy
من قبل Ibrahim Magdy , Senior Full Stack Software Developer , Trustwave

it's a good design pattern to use interface and/or abstract classes Any programmer should use it let me give you an example, suppose that you are doing an application and you have one class that reads configuration from a file. you want to replace this by reading configuration from database MySQL for example .. you have two solution either to rewrite the class or better to keep the old class make an abstract class or interface that exposes public APIs .. that will make your code reusable and also much more easier to maintain plus you can maintain both functionalities, for example you can make a switch that changes which instance you are going to use not only that but interfaces can help others to make some new functionality without going through the code it can help as well in scalability of the code . Each part has a definite interface less documentation as well as easy to understand code although it might make the debugging a bit hard

Sudheer Muhammed
من قبل Sudheer Muhammed , Senior .Net Developer , ADNOC Logistics and Services

1. For defining Service contracts in WCF.

2. For removing dependencies in concrete classes by implementing IoC design patterns.

3. For developing classes that should implement uniform functionalities.

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