Thursday, June 26, 2014

OOP question

First of all: Your naming is not the usual one. Interfaces are normally prefixed with an I. There is no concrete rule, but I prefer the Base prefix.


Secondly, an abstract class makes normally only sense when you have a common code base to share. Just sharing properties sounds like you should go for an interface instead.


Then your abstract class sounds semantically wrong, I would expect:



public interface IResource
{
//
}

public interface IResourceGatherer<R> where R : IResource
{
public List<T> Collect(string id);
}



Now you can derive your UserProfile from IResource.


No comments:

Post a Comment