F
Francisco Amaro
Hi all,
Have question about inheriting a class that has parameters in the
constructor such as :
Public MustInherit Class MyParentClass
Public mystring As String
Public Sub New(ByVal paramstring As String)
mystring = paramstring
End Sub
End Class
When I create the subclass :
Public Class MyChildClass <-- VS warns of a Problem here
Inherits MyParentClass
Public Sub ShowString()
MsgBox(mystring)
End Sub
End Class
VS.NET is complaining I need to declare a "sub new" in the child class
because "The base class doesn't have an accessible 'Sub new' that can be
called without arguments."
I don't understand why this should be necessary, I have no intentions of
creating and instance of this child class without the proper arguments in
New, why should a redefinition of the constructor be required?
Is this a special case for the constructor or am I missing something in how
inheritance works in .net ?
Thanks for any clarification provided,
Francisco
Have question about inheriting a class that has parameters in the
constructor such as :
Public MustInherit Class MyParentClass
Public mystring As String
Public Sub New(ByVal paramstring As String)
mystring = paramstring
End Sub
End Class
When I create the subclass :
Public Class MyChildClass <-- VS warns of a Problem here
Inherits MyParentClass
Public Sub ShowString()
MsgBox(mystring)
End Sub
End Class
VS.NET is complaining I need to declare a "sub new" in the child class
because "The base class doesn't have an accessible 'Sub new' that can be
called without arguments."
I don't understand why this should be necessary, I have no intentions of
creating and instance of this child class without the proper arguments in
New, why should a redefinition of the constructor be required?
Is this a special case for the constructor or am I missing something in how
inheritance works in .net ?
Thanks for any clarification provided,
Francisco