Since Ellipse sealed, and sealedmeans that "can not be inherited," you can not inherit it.
Alternatively, you can use the Decorator Pattern , which helps us extend the behavior of classes without inheritance.
public abstract class ShapeDecorator : Shape {
protected Shape Shape {get; private set;}
protected(Shape shape) {
this.Shape = shape;
}
}
public abstract class EllipseDecorator : ShapeDecorator {
protected(Ellipse ellipse) : base(shape) {
}
public Ellipse Ellipse { get { (Ellipse)base.Shape; } }
}
public class Ball : EllipseDecorator {
public Ball() : base(new Ellipse()) {
}
}
, - Ellipse, ball.Ellipse. Shape, Ball .