Can I have my derived class automatically use the base constructor?
abstract-class, constructor, vb.net
Solution
In VB.Net you use:
`MyBase.New(args)`
Inside your constructors method body, no extra verbiage is used on the constructors/method signature.
Problem
I have an abstract class that has two constructors. When another class inherits this class, it appears that I have to declare contructors with identical signatures as the ones in the base class. This seems a bit redundant to me. Is there a way to have `Sub New(Parameter as MyClass)` in my base class and have this become the default constructor signature unless the derived class includes it in its definition? Edit for clarity: I was hoping it was implied that I do not want to have to create a constructor in the derived class that calls the base class. I would like to be able to do this: ``` Mustinherit Class MyBase Sub New(MyParam As String) End Sub End Class Class MyDerived Inherits MyBase End Class ``` Notice now the derived class doesn't call the base?