Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   circle & ellipse relationship (http://www.go4expert.com/forums/circle-ellipse-relationship-t6573/)

vql 27Sep2007 21:29

circle & ellipse relationship
There are alot ideas about the relationship between circle & ellipse. And I don't know I should design class circle inherit from class ellipse or ellipse inherit from circle. Please give me some suggests, and clues. Thanks alot.

shabbir 27Sep2007 21:54

Re: circle & ellipse relationship
I think the following statement should make your relationship clear

Circle is a kind of ellipse where Major axis and minor axis are same ( as radius ).

But remember that there is not a "is a" relationship between the two but just a kind of relationship between them.

DaWei 27Sep2007 23:56

Re: circle & ellipse relationship
A circle is a kind of ellipse, so the elliplse would be the parent. The circle would be a child with the minor and major axes having the same value (a specialization). You could not specialize a circle to be any possible ellipse, because if you changed one axis, it would not be a circle (or a child of a circle).

vql 13Oct2007 16:19

Re: circle & ellipse relationship
That it mean: Circle is child & Ellipse is Parent?
But I read Java APIs. It doesn't distinguish Ellipse & Circle. Java only have class Ellipse2D, not have class Circle2D.

According to you, if you are a designer. You have a class Ellipse, and will you create a class Circle inherit from Ellipse or not?

All times are GMT +5.5. The time now is 00:06.