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 expression tree with example?
Explain what is copy constructor?
if a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
Why are mutable structs evil?
How long does it take to learn c# programming?
What is a dimensional array?
What is the difference between static and private constructor in c#?
Is string a class in c#?
When should I use static in C#?
What is difference between first and firstordefault?
Explain the three test cases in unit testing?
What is a virtual property. Give an example?
what are the contents of an assembly ?
Explain the functionalities of satellite assembly?
For methods inside the interface why can’t you specify the accessibility modifier?