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

Define property in c#.net?

723


How to achieve polymorphism in c#?

747


Define multicast delegate? How it be used?

794


What is immutable in C#?

791


What is the difference between constants and read-only?

707


What is the benefit of dependency injection c#?

682


Why c# is called type safe language?

656


Can a private virtual method can be overridden?

758


If you want to write your own dot net language, what steps you will u take care?

769


Explain the process of abstraction with an example?

698


What does xpath return?

758


What is signature c#?

678


How do you implement thread synchronization in c#?

662


What is scope c#?

661


What is new method in c#?

697