From: Screamin Lord Byron on
On 06/26/2010 06:21 PM, Martin Gregorie wrote:
> On Sat, 26 Jun 2010 11:53:23 -0400, Arne Vajhøj wrote:
>
>>
>> I would even say that #3 is sometimes practical, but it is not good OOP.
>>
> Then the geometric drawing example that's often seen in teach-yourself
> Java and C++ books where Point is defines as a concrete base class and
> then extended extended to form Circle, Ellipse, Rectangle, Triangle, ....
> classes shouldn't really be used because its bad OOP?

What book is that? There is a huge difference between IS-A and HAS-A
relationship.

Circle is not a point, therefore it cannot extend Point. Circle HAS-A
point. Circle IS-A geometric shape. Class GeometricShape should, of
course, be made abstract.
From: Screamin Lord Byron on
On 06/26/2010 11:14 PM, Martin Gregorie wrote:
> On Sat, 26 Jun 2010 13:09:25 -0400, Arne Vajhøj wrote:

>> I assume that you mean Figure and not Point as base class.
>>
> Unfortunately not:
>
> "Data Abstraction and Object-Oriented Programming in C++" by Gorlen,Orlow
> and Plexico uses Point as components within Line and Circle classes
> though without explicit inheritance: I don't read C++ well enough to
> understand much more than this, but I think there's no inheritance and no
> abstract base class.

That's right. Point is an attribute of Line and Circle. That's
composition, not inheritance. I believe this discussion was about
inheritance, so I must admit that I fail to see your point.