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.
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.
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).
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?