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 does int parse do in c#?
Which of the following operations can you not perform on an ado.net dataset?
What is dynamic object in c#?
What is writeline in c#?
What is difference between singleordefault and firstordefault?
How do you encapsulate in c#?
Can arraylist hold primitive types?
How to sort an int array in c#?
What are class fields?
Can we inherit class that contains only one private constructor?
What are the 4 pillars of any object oriented programming language?
How do I run a cshtml file?
What is Event - Delegate?
Why cannot you specify the accessibility modifier for methods inside the interface?
Can we declare private class in c#?