2017-11-17 431 views
-8

このエラーが発生していますか?CS7036 C#必要な仮パラメータに対応する引数はありません

namespace CalculatorTest 
{ 
    public class Calculator 
    { 
     public int operand1; 
     public int operand2; 
     public static string s; 
     public static int n; 

     public string WriteText(string s) 
     { 
      return s; 
     } 

     public string WriteNumber(int n) 
     { 

      return n.ToString(); 
     } 
     public Calculator(int operand1, int operand2) : base() 
     { 
      this.operand1 = operand1; 
      this.operand2 = operand2; 
     } 
    } 

    class Program 
    { 
     static void Main(string[] args) 
     { 
      Calculator c = new Calculator(); 

     } 
    } 
} 
+2

あなたは少なくともあなたのエラーがどのラインであるか教えていただけますか?ここに助けてください... – DavidG

+5

...ヒントとして、あなたのコンストラクタは引数を必要とします... – DavidG

答えて

1

コンストラクタ(operand1、operand2)には2つのパラメータを定義しましたが、コンストラクタは何も指定せずに呼び出します。だからあなたのコードを使用したい場合は

Calculator c = new Calculator(5,10); 
関連する問題