Reputation: 419
I have 3 methods.
1 method holding the value of 3000 1 method holding the value of 0.13
and I have created another method that I want to multiply these two figures together.
public override int FishPerTank()
{
return 3000;
}
public override double WeightOut(double weightOut, double weightIn)
{
return 0.13;
}
public override int HowMuchTheFishWeighOutKG()
{
return (FishPerTank() * WeightOut());
}
I am receiving the syntax error on the WeightOut here:
public override int HowMuchTheFishWeighOutKG()
{
return (FishPerTank() * WeightOut());
}
Upvotes: 4
Views: 9206
Reputation: 68410
WeightOut
expect 2 parameters and you're not providing them
Upvotes: 13
Reputation: 12672
WeightOut()
expects two parameters. But why ? You don't use them.
Rewrite your method without the 2 parameters
public double WeightOut()
{
return 0.13;
}
Upvotes: 5
Reputation: 26068
You probably want to change
public override double WeightOut(double weightOut, double weightIn)
{
return 0.13;
}
to
public override double WeightOut()
{
return 0.13;
}
as you aren't using the parameters.
also why the override? May need to remove that if removing the parameters causes another syntax error, or fix it in the base class as well.
Upvotes: 3
Reputation: 116411
WeightOut(double weightOut, double weightIn)
is declared with two parameters and you're calling it with none. Hence the error.
Upvotes: 5