473,587 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

single instance base class

I want to have a single instance of a base class that all the child classes
inherits from.
The base class is going load data from text files and this only needs to be
done once.
What I don't need is every time a child class is created that it goes out
and creates another instance of the base class, which then would go out and
load data from those text files.

Am I making sence here?
How can I do this in VB.Net?

Thanks

Mike w.
Nov 21 '05 #1
2 1516
Hi,

Added shared members to your class.
http://msdn.microsoft.com/library/de...akeyShared.asp

Ken
--------------------
"mike w." <mi***@discussi ons.microsoft.c om> wrote in message
news:3A******** *************** ***********@mic rosoft.com...
I want to have a single instance of a base class that all the child classes
inherits from.
The base class is going load data from text files and this only needs to be
done once.
What I don't need is every time a child class is created that it goes out
and creates another instance of the base class, which then would go out and
load data from those text files.

Am I making sence here?
How can I do this in VB.Net?

Thanks

Mike w.
Nov 21 '05 #2
Hi,

Added shared members to your class.
http://msdn.microsoft.com/library/de...akeyShared.asp

Ken
--------------------
"mike w." <mi***@discussi ons.microsoft.c om> wrote in message
news:3A******** *************** ***********@mic rosoft.com...
I want to have a single instance of a base class that all the child classes
inherits from.
The base class is going load data from text files and this only needs to be
done once.
What I don't need is every time a child class is created that it goes out
and creates another instance of the base class, which then would go out and
load data from those text files.

Am I making sence here?
How can I do this in VB.Net?

Thanks

Mike w.
Nov 21 '05 #3

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

Similar topics

14
3315
by: Sridhar R | last post by:
Consider the code below, class Base(object): pass class Derived(object): def __new__(cls, *args, **kwds): # some_factory returns an instance of Base # and I have to derive from this instance!
6
6655
by: Microsoft | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
7
6606
by: Baski | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
0
269
by: mike w. | last post by:
I want to have a single instance of a base class that all the child classes inherits from. The base class is going load data from text files and this only needs to be done once. What I don't need is every time a child class is created that it goes out and creates another instance of the base class, which then would go out and load data from...
4
1638
by: Joe HM | last post by:
Hello - I have a Base Class where I want a New() implemented that can be called from the outside. This New() should create an instance of the appropriate cDerivedX Class ... The following shows a scenario where it was determined that cDerivedA is needed based on a configuration file. Dim lInstance As New cBase()
5
1463
by: Russell Warren | last post by:
I just ran across a case which seems like an odd exception to either what I understand as the "normal" variable lookup scheme in an instance/object heirarchy, or to the rules regarding variable usage before creation. Check this out: >>> class foo(object): .... I = 1 .... def __init__(self): .... print self.__dict__ .... ...
8
1664
by: Lou Pecora | last post by:
I've been scanning Python in a Nutshell, but this seems to be either undoable or so subtle that I don't know how to do it. I want to subclass a base class that is returned from a Standard Library function (particularly, subclass file which is returned from open). I would add some extra functionality and keep the base functions, too. But I...
2
2183
by: awryavari | last post by:
Hello All, I have case where I create one instance of a class "Base" and there are various other child objects that I need to create ("Derived" from "Base"). Is there a pattern where I could ensure that once I create a base class instance in memory, all derived classes refer the same base instance ? class Base{ //..functions etc } class...
2
5492
by: Mesan | last post by:
Hello everyone, Thanks to many useful posts in this newsgroup and others, I've been able to come very close to something I've been wanting to do for a very long time. I've figured out how to create a new custom protocol handler in Windows to handle locations like "myProtocol:", which lets me have a shortcut pointing to...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.