This is my code:
class Program
{
abstract class Shape
{
public abstract double GetArea();
}
class Rectangle : Shape
{
double length = 100.57;
double width = 100.14;
public override double GetArea()
{
double result = length * width;
return result;
}
}
class Circle : Shape
{
double radius = 50.34;
public override double GetArea()
{
double result = Math.PI * Math.Pow(radius, 2);
return result;
}
}
static void Main(string[] args)
{
}
}
Why does it not return anything? I wanted the result from length * width in my GetArea() method and the area from the circle too. I tried it with return and then the result but if I start the application nothing happens. I also tried doing this:
static void Main(string[] args)
{
GetArea();
}
But that gets just red underlined.