lundi 20 avril 2015

What would be the best pattern/design in C# to do the following

I have a class A that uses class B, class B is not defined in the same project (project alpha), but in a different project (project beta), However, class B would be sort of a wrapper for class1, class2 or class3 that are specific to different platforms. I would like to have project alpha compiling without needing project beta, and project beta will overwrite/overload the methods or implementations of class B so that it works for the specific object types of each platforms.

UPDATE:

For instance:

public class Scene {
    private Drawable d;
    public bool GetDrawablePixel(int x, int y){
        return d.GetPixel(x,y);
    }
}

public interface Drawable {
   bool GetPixel(int x, int y);
}

For each platform we would have different drawable objects such as Bitmap, Image etc.. but I am planning on merging them all and get a general GetPixel method that works for all of them, not just that one method but also other and properties.

Aucun commentaire:

Enregistrer un commentaire