im having a bit of a problem trying to plan for my solution. its a very basic drawing program with shapes.
im not exactly sure which way to hit this, these are the elements i should have in there:
a shape class - base class for any inheritence
a point class - is a single point object, like a coordinate
a line class - is a line between two 'points'
a rectangle class - is a square (consists of four lines)
a polygon class - is a 'n' sided shape (consists of 'n' lines)
the model i have so far is something like this:
Shape Class // Base class
Point Class // Inherits from Shape
Line Class // Inherits from Point
Rectangle Class Polygon Class // These classes both inherit from Line class
This is something along the lines of what i was thinking, but im also thinking it wont work very well because for example the 'Rectangles' class inherits from 'Line', however in reality the 'Rec' class should have a collection of 'Line' (4 lines in a square) right?
so in this case would everything just equally inherit from 'Shape' ? or will i be able to have collections of base classes in my sub (inherited) classes?