© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
5 replies
Finnland

I cant figure out constructor inheritance

how do i inherit classes, including their constructors?
no matter what i try i get a wide variety of different errors.
i have tried just:
public class SubClass : Superclass {
  
}
public class SubClass : Superclass {
  
}

but then i get the error
'SuperClass' does not contain a constructor that takes 0 arguments
'SuperClass' does not contain a constructor that takes 0 arguments

so then i tried adding
public class SubClass : Superclass {
  public SubClass(arg) : base(arg)
  {
    
  }
}
public class SubClass : Superclass {
  public SubClass(arg) : base(arg)
  {
    
  }
}

but that gives me an error that i need a method body. How do i inherit the constructors in addition to the rest of the class?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Abstract forced empty constructor inheritance
C#CC# / help
3y ago
✅ Why is this different I cant figure this out
C#CC# / help
16mo ago
i cant figure out whats wrong with my code
C#CC# / help
2y ago