1 'WindowsFormsApplication3.student가'0 인수 C를 사용하는 생성자를 포함하지 않는 오류 : \ 사용자 마리우스 \ 문서가 프로젝트 \ 비주얼 스튜디오 2012 \ \ \ pregatiret \ WindowsFormsApplication3 \ 32C#의 OOP 상속 오류
Form1.cs를
public class persoana
{
public string nume;
public int varsta;
public persoana(string num, int var)
{
this.nume = num;
this.varsta = var;
}
public class student : persoana
{
public string facultate;
public int grupa;
public student(string nume,int varsta,string fac,int grupa) : base(nume,varsta){
this.facultate = fac;
this.grupa = grupa;
}
public partial class Form1 : Form
{
persoana y;
student x;
ArrayList listaStudenti = new ArrayList();
ListViewItem itm;
public Form1()
{
InitializeComponent();
}
private void inserareToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 m = new Form2();
m.ShowDialog();
if (m.DialogResult == DialogResult.OK)
{
x = new student(); **//I GET ERROR HERE**
}
}
당신의 학생 클래스는 빈 생성자가없는 것으로 기대하고있다. 그것은 nume, varsta 등을 원합니다. – LarsTech
감사합니다. 나는 또한 기본 클래스에 빈 생성자가 필요했습니다. 다시 감사합니다. – mariusxd