C#C
C#3y ago
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 {
  
}

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

so then i tried adding
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?
Was this page helpful?