473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

inheriting constructors in vb.net

Books online says that constructors are not inherited in vb.net (grrr - why
not?)

I have a series of classes that share the same constructors and find myself
cutting and pasting when i make changes to them ... a sure sign of something
badly wrong.

How do you all deal with sharing this code?
I can't seem to find any sort of #include feature
Is there some option?

thanks!

brad
Nov 20 '05 #1
4 1931
> I have a series of classes that share the same constructors and find
myself
cutting and pasting when i make changes to them ... a sure sign of something badly wrong.
How do you all deal with sharing this code?
I can't seem to find any sort of #include feature
Is there some option?
you can call the base class constructor by means of the MyBase class. Here'
an example:
public class TheBase
public sub New()

end sub
end class

public class TheDerived : Inherits TheBase
public sub New()
MyBase.New()
end sub
end class
thanks!
HTH
brad


--
..A [Microsoft MVP .NET]
UGIdotNET - User Group Italiano .NET
http://www.ugidotnet.org
Read my blog at: http://www.ugidotnet.org/4.blog
Nov 20 '05 #2
> I have a series of classes that share the same constructors and find
myself
cutting and pasting when i make changes to them ... a sure sign of something badly wrong.
How do you all deal with sharing this code?
I can't seem to find any sort of #include feature
Is there some option?
you can call the base class constructor by means of the MyBase class. Here'
an example:
public class TheBase
public sub New()

end sub
end class

public class TheDerived : Inherits TheBase
public sub New()
MyBase.New()
end sub
end class
thanks!
HTH
brad


--
..A [Microsoft MVP .NET]
UGIdotNET - User Group Italiano .NET
http://www.ugidotnet.org
Read my blog at: http://www.ugidotnet.org/4.blog
Nov 20 '05 #3

"Andrea Saltarello [MVP][UGIdotNET]" <pa*********************@phaseit.com>
wrote in message news:OM**************@TK2MSFTNGP11.phx.gbl...
I have a series of classes that share the same constructors and find myself
cutting and pasting when i make changes to them ... a sure sign of

something
badly wrong.
How do you all deal with sharing this code?
I can't seem to find any sort of #include feature
Is there some option?

you can call the base class constructor by means of the MyBase class.

Here' an example:
public class TheBase
public sub New()

end sub
end class

public class TheDerived : Inherits TheBase
public sub New()
MyBase.New()
end sub
end class


that's what i'm doing now - but I have 10 subclasses and ~8 different
constructors
so i'm cutting and pasting the mybase stuff 10 times...
ugly
Nov 20 '05 #4

"Andrea Saltarello [MVP][UGIdotNET]" <pa*********************@phaseit.com>
wrote in message news:OM**************@TK2MSFTNGP11.phx.gbl...
I have a series of classes that share the same constructors and find myself
cutting and pasting when i make changes to them ... a sure sign of

something
badly wrong.
How do you all deal with sharing this code?
I can't seem to find any sort of #include feature
Is there some option?

you can call the base class constructor by means of the MyBase class.

Here' an example:
public class TheBase
public sub New()

end sub
end class

public class TheDerived : Inherits TheBase
public sub New()
MyBase.New()
end sub
end class


that's what i'm doing now - but I have 10 subclasses and ~8 different
constructors
so i'm cutting and pasting the mybase stuff 10 times...
ugly
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sureshsundar007 | last post by:
Hi all, I'm trying to inherit the SimpleWorkerRequest class but cant able to do so. I'm getting an error called "System.Web.Hosting.SimpleWorkerRequest.SimpleWorkerRequest()' is inaccessible...
2
by: SpotNet | last post by:
Hi Newsgroup, Reconstructing my common dialog assembly using C# 2.0 .NET Framework 2.0. I have the following; public class FileDialogBase: System.Windows.Forms.FileDialog { //No constructor...
2
by: Jim Heavey | last post by:
I amd playing around with inheritance a little in VB.Net If I create a new class which inherits from ListViewItem and I am only wanting to override the ToString Method. In this situation, If I...
0
by: Brad Langhorst | last post by:
Books online says that constructors are not inherited in vb.net (grrr - why not?) I have a series of classes that share the same constructors and find myself cutting and pasting when i make...
4
by: elziko | last post by:
I would like to do the following: Create a class that inherits from a usercontrol. Then add a control to the designer Call this new class ClassA. Many controls I need will start off like this...
2
by: TCook | last post by:
Hello All, First I tried to inherit from the TabPageCollection class but received the following error message: No overload for method 'TabPageCollection' takes '0' arguments I also tried...
2
by: Christof Warlich | last post by:
Hi, I'd like to define a class that should behave as much as posible like std::string, but that has some small additional property: class ExtendedString: public std::string { public: void...
0
by: Jack Jackson | last post by:
There is a class (over which I have no control) that has no public constructors - new instances are created via a Static function. I would like to modify the behavior of one of the methods of...
4
by: Thomas Wittek | last post by:
Hi! I'm relatively new to Python, so maybe there is an obvious answer to my question, that I just didn't find, yet. I've got quite some classes (from a data model mapped with SQL-Alchemy)...
4
by: AalaarDB | last post by:
struct base { int x, y, z; base() {x = 0; y = 0; z = 0;}; base(int x1, int y1, int z1) {x = x1; y = y1; z = z1;}; }; struct intermediate1 : public virtual base {}; struct intermediate2 :...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.