473,671 Members | 2,215 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 1520
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
3320
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
6657
by: Microsoft | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
7
6615
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 those text files. Am I making sence here? How can I do this in VB.Net?
4
1644
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
1468
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__ .... self.I += 1
8
1668
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 am stuck. E.g.
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 Derived: public Base{
2
5498
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 "myProtocol:myPrimaryKey" and have my application automatically open and display the given account. That's great. I
0
8472
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8909
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8596
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2806
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
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.