# C# inhertitance question

**URL:** <https://forum.kirupa.com/t/c-inhertitance-question/241675>\
**Category:** Uncategorized\
**Created:** [October 16, 2007, 10:36pm UTC](https://forum.kirupa.com/t/c-inhertitance-question/241675 "2007-10-16T22:36:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![exempt](https://avatars.discourse-cdn.com/v4/letter/e/ecccb3/32.png) [@exempt](https://forum.kirupa.com/u/exempt)\
**Post date:** [October 16, 2007, 10:36pm UTC](https://forum.kirupa.com/t/c-inhertitance-question/241675/1 "2007-10-16T22:36:11Z")

</div>

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?
