我在C#中學習OOP,在編碼過程中遇到問題。我想創建一個帶有構造函數的類,它將通過Console.ReadLine
讀取屬性。不幸的是,我收到了一個我無法理解的奇怪錯誤。如何編輯我的課
這是我的課:
public class Klasa
{
int zarobki;
string nazwisko;
string stanowisko;
public Klasa(string a, string b, string c)
{
a = (Console.ReadLine());
b = (Console.ReadLine());
c = (Console.ReadLine());
zarobki = int.Parse(a);
nazwisko = b;
stanowisko = c;
}
}
編譯後,我得到了以下錯誤:
"Severity Code Description Project File Line Suppression State Error CS7036 There is no argument given that corresponds to the required formal parameter 'a' of 'Klasa.Klasa(string, string, string)' ConsoleApplication17 c:\users\dell\documents\visual studio 2015\Projects\ConsoleApplication17\ConsoleApplication17\Program.cs 13 Active ".