SUB NEW arguments do not match parent's SUB NEW arguments

The parameters in the derived class's Sub New differ in number or type from the parameters in the base class's Sub New. For example:

Class Baseclass
   Sub New (X As Long)
   End Sub
End Class
Class Derivedclass As Baseclass
   Sub New (X As Long, Y As Long) ' Illegal, because Y is not a parameter
                                  ' in Baseclass's Sub New.
   End Sub
End Class

Do one of the following:

  • In the derived class's Sub New declaration, specify which arguments to pass to the base class's Sub New, for example as follows:
    Class Derivedclass As Baseclass
       Sub New (X As Long, Y As Long), Baseclass (X)
       End Sub
    End Class
  • Redefine the derived class's Sub New so that its parameters match those of the base class's Sub New. For example:
    Class Derivedclass As Baseclass
       Sub New (X As Long)
       End Sub
    End Class