How to fix “No overload for method ' ' takes 0 arguments”?

后端 未结 5 1463
栀梦
栀梦 2020-11-30 14:24

How can I fix this error?

\"No overload for method \'output\' takes 0 arguments\".

The error is at the very bottom at \"fresh.o

相关标签:
5条回答
  • 2020-11-30 14:42

    It's telling you that the method "output" needs arguments. Here's the signature for "output":

    public override void output(double o, double tw, double th, double f)
    

    So if you want to call that you need to pass in four doubles.

    fresh.output(thing1,thing2,thing3,thing4);
    

    Or to use hard coded values as an example:

    fresh.output(1,2,3,4);
    
    0 讨论(0)
  • 2020-11-30 14:52

    You're calling the output method with 0 (zero) parameters, but you have declared it to receive 4 double values. The compiler doesn't know what it should call, since there is no output method with no parameter.

    0 讨论(0)
  • 2020-11-30 14:54

    fresh.output() expect 2 parameters and you're not providing them

    0 讨论(0)
  • 2020-11-30 14:58

    There's no method named output that takes 0 arguments, there's only one that accepts 4 arguments. You must pass parameters to output():

    foreach (Numbers fresh in chosen)
    {
        fresh.output(o, tw, th, f);
    }
    
    0 讨论(0)
  • 2020-11-30 15:02

    All your implementations of method output takes arguments. Supply the arguments and you should be able to compile.

    Like this:

    fresh.output(1, 2, 3, 4);
    
    0 讨论(0)
提交回复
热议问题