Design problem - Abstract or Interface
I am making a graphical application for a class. The problem is simple in that i need to create an array that stores a bunch of circles, but only if they don't intersect with a previous circle. This part is easy; however, I wanted to expand the functionality to allow for more shapes(like a square to be drawn). What in your opinions should i design it as. Either a interface or an abstract class - both seem to work and yet don't. Thanks for any help in this matter.
I think this depends on your exact usage. If this class will only ever be used to draw shapes then an abstract Shape class seems appropriate, with a method called something like draw() (among other things) that it could call.
If you want it to be able to draw anything, things that are otherwise unrelated, then an interface called Drawable (or something similar) would be appropriate. This would again have a method called draw() etc that would be used to draw it.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center