Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do WCF services use interfaces as a Service Contract instead of an abstract class?

This is a question I got asked in an interview.

When you create a WCF service, you get two files; "IService.cs" and "Service.cs". Why is it a class implementing an interface versus a class inheriting an abstract class. Don't reply saying that you cannot put a [servicecontract] attribute over the abstract class. I know you can only apply it to interfaces, but why?

like image 356
fbhdev Avatar asked Dec 13 '22 07:12

fbhdev


1 Answers

One can implement more than one interface. One can only inherit a single abstract class.

like image 90
John Saunders Avatar answered May 16 '23 09:05

John Saunders