If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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.