cs11dotnet7/vscode/Chapter06/Ch06Ex02Inheritance/Circle.cs

29 lines
400 B
C#
Raw Permalink Normal View History

2022-02-27 20:08:52 +01:00
namespace Packt.Shared;
public class Circle : Square
{
public Circle() { }
public Circle(double radius) : base(width: radius * 2) { }
public double Radius
{
get
{
return height / 2;
}
set
{
Height = value * 2;
}
}
public override double Area
{
get
{
double radius = height / 2;
return Math.PI * radius * radius;
}
}
}