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

Can abstract class instantiated c#?

706


What is the purpose of static?

770


What does mean c#?

730


Are structs value types or reference types?

798


So what makes your code really object-oriented #?

728


Is datetime nullable c#?

734


How jit (just in time) works?

721


How do you sort an array in c#?

723


What is the difference between Decorator and Adapter pattern?

751


Is stringbuilder faster than string concatenation c#?

712


How Is The Dll Hell Problem Solved In .net?

809


How can I process command-line arguments?

745


What is the difference between abstraction and encapsulation in c#?

739


Suppose you have already existing application with Visual Studio 6 (VB 6, InterDev 6) and this application utilizes Windows 2000 COM+ transaction services. With this example how can you approach migrating this application to .NET?

715


What are the delegates in c#?

715