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
What are the differences between a class and a struct?
What is the property of a class in c#?
How can I produce an assembly?
What is arraylist c#?
Is arraylist faster than linkedlist?
What does break do in loop?
What is sorted list in c#?
What are delegates and why are they required?
What is c# used for?
Describe ways of cleaning up objects in c#.
Explain the process of polymorphism with an example?
Contrast between an interface and abstract class?
What is Private Constructor? and it’s use? Can you create instance of a class which has Private Constructor?
Why dictionary is faster than list?
Can namespace contain the private class?