1
Good morning, does anyone know why the compiler keeps accusing the error saying that the method is not declared as Abstract, but even though I have declared?
Follow the Repl.it link: https://repl.it/@Wellingtonmazon/Triangle calculus And the codes below:
using System;
namespace triangulo
{
class Program
{
static void Main(string[] args)
{
Retangulo r = new Retangulo();
r.Largura = 8.3;
r.Altura = 3.5;
Console.WriteLine("Área do retângulo: {0}", r.CalculaArea());
Triangulo t = new Triangulo();
t.Largura = 8.3;
t.Altura = 3.5;
Console.WriteLine("Área do triângulo: {0}", t.CalculaArea());
}
}
}
using System;
namespace triangulo
{
abstract class FiguraGeometrica
{
public double Largura = 0;
public double Altura = 0;
public abstract double CalculaArea()
{
return -1;
}
}
}
using System;
namespace triangulo
{
class Retangulo : FiguraGeometrica
{
public override double CalculaArea()
{
return Largura * Altura;
}
}
class Triangulo : FiguraGeometrica
{
public override double CalculaArea()
{
return Largura * Altura / 2;
}
}
}
It seems that the people of the . NET like to err this type of message.
– Jéf Bueno