Re: Inheritance guidelines.
* Juha Nieminen:
> [About circles and ellipses]
> The answer is that neither should be inherited from the other. This is
> because a circle and an ellipse are at the *same* conceptual level.
Generally, when that's the case, the person's concepts are flawed :-).
E.g., a constant circle Is-A constant ellipse (the general relationship
is a bit more complicated).
In C++ this can be expressed via interfaces or via implicit conversion.
[snip]
> The correct solution is to create a more abstract concept which is
> common to both circles and ellipses (and other similar drawing
> primitives), for example a "DrawingPrimitive" class, and inherit
> "Circle" and "Ellipse" from it.
Sorry, but there's no general "the" correct solution.
Cheers, & hth.,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
|