circle & ellipse relationship

vql
Go4Expert Member
27Sep2007,21:29   #1
vql's Avatar
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.
Go4Expert Founder
27Sep2007,21:54   #2
shabbir's Avatar
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.
Team Leader
27Sep2007,23:56   #3
DaWei's Avatar
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
Go4Expert Member
13Oct2007,16:19   #4
vql's Avatar
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?