CS7036 C# There is no argument given that corresponds to the required formal parameter of

前端 未结 2 785
你的背包
你的背包 2020-12-22 14:29

WHy im i getting this error?

namespace CalculatorTest
{
    public class Calculator
    {
        public int operand1;
        public int operand2;
        p         


        
相关标签:
2条回答
  • 2020-12-22 14:50

    That's it, the error CS7036 in C# is that your class is calling a constructor that have no parameters, but it should have parameters.

    0 讨论(0)
  • 2020-12-22 15:08

    As it is mentioned earlier You defined two parameters for constructor (operand1, operand2) but then You invoke constructor without any. So If You want to have Your code working use

    Calculator c = new Calculator(5,10);
    
    0 讨论(0)
提交回复
热议问题