just learning c#, so i apologize if this is a newbish question…
im working on inheritance, and ran into a problem…when you have a constructor in the main class, how can you get it to carry over to the child class? here is what i have…
class MainClass
{
public string newString;
public MainClass(string n){ newString = n; }
}
class ChildClass : MainClass
{
// some stuff
}
class Program
{
static void Main(string[] args)
{
ChildClass thisClass = new ChildClass(“String”);
}
when I run it, I get a “ConsoleApplication.MainClass does not contain a constructor that takes ‘0’ arguments”; “ConsoleApplication.ChildClass does not contain a constructor that takes ‘1’ arguments”
is there a way to fix this, or do constructors not inherit?