What is the best design I can use to define methods with same name?

There is a design problem like this.

Suppose you have a set of class that implements similar methods but not identical ones.

Example : The ClassA has methods like this.

void Add(string str);
void Delete(string str);
List<string> GetInfo(string name);

Another class, ClassB has the following methods.

void Add(Dictionary Info);
void Delete(string str);
Dictionary GetInfo(string name);

So the nature of the methods are similar but the return types/ input parameters are different. If I develop an interface to keep the consistency I can only define Delete operation there. Alternatively I can think about a set of independant class without any relationships with each other (Of course no interface implementations) but I don't think it is a good design.

  1. What is the approach I can use to implement this?
  2. I am new to generic interfaces. Does it help in this case? If so I am going to learn and implement using them.
5
задан Cody Gray 19 November 2010 в 09:51
поделиться