in reply to Re: inheritance and object creation
in thread inheritance and object creation

You're mixing terms. A 71-sided polygon isn't a parallelogram, so to discard it because it doesn't have rotational symmetry is a straw man.

There are a set of properties that all polygons have (closed, etc), and a set of properties that all regular polygons have (regular angles, sides of the same length, and rotational symmetry at least 360/n degrees around the center, where n is the number of sides). This seems to lend itself to an inheritance tree, but, like the fibonacci sequence, the first approach isn't appropriate.

Instead, the more appropriate approach would seem to be to elaborate the rules that arise based on the properties of the object, not the class, and to (potentially) precalculate those results on object creation (with appropriate caching). For example, a square has certain properties. So, when an object of the ClosedShape class is instantiated that matches the properties of a square, the appropriate results would be calculated. But, it's still of the ClosedShape class.

I think that this would start to solve the generic and specific problems you have flyingmoose have raised.

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Shapes don't need inheritance
by Abigail-II (Bishop) on Feb 25, 2004 at 19:43 UTC
    You too? I already explained to flyingmoose I was talking about shapes, not polygons. Why talk about polygons as well?

    Abigail

      polygon: A closed plane figure formed by three or more line segments that do not cross over each other. (http://www.shodor.org/interactivate/dictionary/p.html)

      That is what most people refer to when they discuss shapes. Hence, why flyingmoose and I used the term polygon when replying to you.

      ------
      We are the carpenters and bricklayers of the Information Age.

      Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

        Yeah, sure, whatever. I give up. I can repeat over and over again I was talking about shapes, but you continue to insist in talking about something else.

        I'm done with this thread.

        Abigail