Hi,
Can we implement the Abstract class on interface in c#, If
yes then provide the code implementation

Answer Posted / rakesh

public interface IService<T>
{
int Add(T entity);
void Update(T entity);
}

public abstract class ServiceBase<T> : IService<T>
{
public int Add(T entity) { ... }
public void Update(T entity) { ... }
}

public interface ICarService : IService<Car>
{
}

public class SomeBaseClass : ServiceBase<Car>, ICarService
{
public int Add(Car entity);
public void Update(Car entity);
}

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the differences between a class and a struct?

477


What is the property of a class in c#?

496


How can I produce an assembly?

587


What is arraylist c#?

466


Is arraylist faster than linkedlist?

495






What does break do in loop?

492


What is sorted list in c#?

511


What are delegates and why are they required?

511


What is c# used for?

515


Describe ways of cleaning up objects in c#.

512


Explain the process of polymorphism with an example?

476


Contrast between an interface and abstract class?

543


What is Private Constructor? and it’s use? Can you create instance of a class which has Private Constructor?

552


Why dictionary is faster than list?

556


Can namespace contain the private class?

497