Website Design United States, Website Design California, Website Designing United States, Website Designing California

MustInherit Class with parameters in the constructor

MustInherit Class with parameters in the constructor

by: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



    Enquiry
 






    Contact us
340 W, 26th Street, Suite F, National City, California - 91950 United States
Tel : 818-667-2853
Info@webbgirrl.com

















 

 

 

 

 

 

 

 

 

 

Ajax Technologies | Foodgear Shop| Lowest Unique Bid Auction | Our Team | Terms And Condition | What is encapsulation | MustInherit class with parameters in the constructor | How to extract src from img elements in html code | How to extract url and anchor from html content | Grab the content of a webpage using C | How to extract the host name from an url C| How to send an email using smtp C | How to remove html tags from web content C | How to convert date time to sql valid string | Set row color in datagrif web from | Disclaimer | How to refresh the data in an xml reader object | Aprendiendo ms access 2000 en 24 horas | Microsoft visual C++ net step by step | Possible to disable a row in listview | Designing sql server 2000 databases for net enterprise | Biztalk server 2000 developer guide for net
© 2008-2009 webbgirrl.com