cs11dotnet7/vscode/Chapter06/Ch06Ex02Inheritance/Circle.cs
2022-02-27 19:08:52 +00:00

29 lines
400 B
C#

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;
}
}
}