请问我重写方法为什么没值出来呢
public class Program{
public double a, b, c;
public Program(double a, double b, double c)
{
this.a = a;
this.b = b;
}
public Program() { }
public virtual double adc(double a,double b)
{
double ac;
ac=a*b;
return ac;
}
}
public class abb:Program
{
public abb(double a, double b,double c):base(a,b,c)
{
}
public override double adc(double a,double b)
{
double f;
f = a * b * c;
return f;
}
}
public class add
{
static void Main(string[] args)
{
double a = 2; double b = 3; double c = 4;
Program e = new abb(a,b,c);
Console.WriteLine(e.adc(a,b));
add r = new add();
}
}
}
--------------------编程问答-------------------- 请高手告诉我为什么, --------------------编程问答-------------------- 低能问题,没的回答我吗?我是新手,还望同志多指点 --------------------编程问答-------------------- 第一个构造函数少了个字段的字段的赋值
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication15
{
public class Program
{
public double a, b, c;
public Program(double a, double b, double c)
{
this.a = a;
this.b = b;
this.c = c;
}
public Program() { }
public virtual double adc(double a,double b)
{
double ac;
ac=a*b;
return ac;
}
}
public class abb:Program
{
public abb(double a, double b,double c):base(a,b,c)
{
}
public override double adc(double a,double b)
{
double f;
f = a * b * c;
return f;
}
}
public class add
{
static void Main(string[] args)
{
double a = 2; double b = 3; double c = 4;
Program e = new abb(a,b,c);
Console.WriteLine(e.adc(a,b));
add r = new add();
}
}
}
--------------------编程问答-------------------- xiexie谢谢
补充:.NET技术 , C#