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

We are obviously talking past each other.

When I said "implementation of a Square" I meant the data structure that you use. An implementation of a Parallelogram needs more information than an implementation of a Square. Which means that you wind up carrying around extra fields. Furthermore while you can inherit methods for calculating things like the area, it is more efficient to calculate those for a Square directly.

There is nothing wrong with inheriting an implementation of a Parallelogram. If you have it. But if you really need a Square, it is far simpler and more efficient to implement that directly rather than to deal with the generalization that is a Parallelogram.

However that point is relatively unimportant (and obviously has nothing to do with multiple inheritance) compared to the others that I had made.

  • Comment on Re: Re: inheritance and object creation