circle & ellipse relationship

vql's Avatar, Join Date: Sep 2007
vql
Go4Expert Member
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.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
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).
0
vql's Avatar, Join Date: Sep 2007
vql
Go4Expert Member
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?