It seems there is a conflict between constructor and setter for "Diameter". The error shows when I try to define a Sphere object.
using System;
namespace Challenge6
{
class Sphere
{
public double Diameter
{
get => Diameter;
set => Diameter = value;
}
public double Volume => (4.0 / 3.0) * Math.PI * Math.Pow(Diameter, 3) / 8.0;
public double Surface => 4 * Math.PI * Math.Pow(Diameter, 2) / 4.0;
public Sphere (double dia)
{
Diameter = dia;
}
}
}