Class derived from a derived class

I figured it out. However a circle class can be derived from an ellipse class.
Last edited on
The Ellipse constructor expects two values but you are only passing one. A circle can be thought of as an ellipse where both radii has the same length so you probably want to pass the same value twice.
Hi,


A Circle is not an Ellipse and vice versa, so one should not inherit from them either way. IIRC there is a bunch of discussion about that exact thing, maybe on gotw (Guru of the Week) ? However I found this:

https://en.wikipedia.org/wiki/Circle-ellipse_problem

An ellipse with both semi-axes being equal could be a circle, but isn't that a little dangerous, or at least weird? It relies on them actually being equal.

It just makes more sense to have:

1
2
3
4
class Shape;

class Circle : public Shape;
class Ellipse : public Shape;
Topic archived. No new replies allowed.