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 is datacontract in c#?
Can the accessibility of a type member be greater than the accessibility of its containing type?
What are circular references? How garbage collection deals with circular references.
Which is faster dictionary or list?
What method is used to sort the elements of the array in descending order?
What is the use of thread join in c#?
What is verbatim literal in c#?
What is helper method in c#?
what is generics? can u explain 5 to 6 examples on generics that covers class,method,structure,list,delegates?
What is private constructor c#?
What do you mean by directing?
What does args mean in c#?
What does void do in unity?
Why do we need abstraction in c#?
What is executereader in c#?