inheritance and instantiation error

  • Thread starter Thread starter Christ Kennedy
  • Start date Start date
C

Christ Kennedy

Guest
I've got a class that inherits another class and they both need to be declared in a similar way but I don't know why this simple example doesn't work

public partial class Form1 : Form
{
public Form1()
{

}
}

public class classA
{
public string strA = "A";
public classA(string strA)
{
this.strA = strA;
}
}

public class classB : classA
{

public classB(string strB)
{
this.strA = strB;
}
}


how come I get the error:

There is no argument given that corresponds to the required formal parameter 'strA' of 'classA.classA(string)' test inheritance C:\Users\Christ\Documents\C#\test inheritance\Form1.cs 33 Active




none of the c# inheritance articles I've read seem to cover this.





my code is perfect until i don't find a bug

Continue reading...
 
Back
Top