Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is datacontract in c#?

893


Can the accessibility of a type member be greater than the accessibility of its containing type?

946


What are circular references? How garbage collection deals with circular references.

919


Which is faster dictionary or list?

924


What method is used to sort the elements of the array in descending order?

960


What is the use of thread join in c#?

920


What is verbatim literal in c#?

892


What is helper method in c#?

925


what is generics? can u explain 5 to 6 examples on generics that covers class,method,structure,list,delegates?

1948


What is private constructor c#?

926


What do you mean by directing?

995


What does args mean in c#?

905


What does void do in unity?

968


Why do we need abstraction in c#?

927


What is executereader in c#?

907