我有這個「EmployeeData.Employees」不包含一個構造函數6變元
錯誤問題1「EmployeeData.Employees」不包含一個構造 需要6個參數C:\用戶\約翰\的文檔\ Visual Studio的 2012 \項目\ ConsoleApplication2 \ ConsoleApplication1 \員工 Data.cs 65 26 EmployeeData工作
(http://pastebin.com/embed_js.php?i=0fbwpthp)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeeData
{
public class Employees
{
private string firstName;
private string lastName;
private int age;
private char gender;
private string PI;
private string uniEmployeeNum;
Employees(){}
Employees(string firstName,
string lastName,
int age,
char gender,
string PI,
string uniEmployeeNum)
{
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.gender = gender;
this.PI = PI;
this.uniEmployeeNum = uniEmployeeNum;
}
public string FirstName()
{
return firstName;
}
public string LastName()
{
return lastName;
}
public string PII()
{
return PI;
}
public string UniEmployeeNum()
{
return uniEmployeeNum;
}
public int Age()
{
return age;
}
public char Gender()
{
return gender;
}
}
class EmployeeData
{
void emp()
{
Employees man = new Employees("John", "Johnny", 19, 'm', "68161863181686", "6846684644");
}
static void Main(string[] args)
{
// Employee man = new Employee("John", "Johnny", 19, 'm', "68161863181686", "6846684644");
}
}
}
這意味着'僱員'類沒有一個構造函數需要6個參數。 –
,因爲你可以看到它有 – user3289317
這是通過在構造函數中添加缺少的'public'修飾符來解決的。 –