473,387 Members | 1,536 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,387 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 1928
> 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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.