473,467 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

static member variable for group of objects

Has anybody come across any pattern to create a static class member
that can be shared across group of objects ?

I understand this can be achieved (thru factory method), by
referencing the (simulated) shared member thru member pointer or
reference.

Is there any better approach ?

regards,
Pramod
Jul 22 '05 #1
1 1162
"pramod" <sp********@yahoo.com> wrote in message
news:c6**************************@posting.google.c om...
Has anybody come across any pattern to create a static class member
that can be shared across group of objects ?

I understand this can be achieved (thru factory method), by
referencing the (simulated) shared member thru member pointer or
reference.

Is there any better approach ?

regards,
Pramod


try singleton. generally used to make a single instance of an object
available to an entire application or module. in the case of single class
requiring access, the singleton methods could be made private static to the
class.

hth
tom
Jul 22 '05 #2

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

Similar topics

29
by: Alexander Mahr | last post by:
Dear Newsgroup, I'm somehow confused with the usage of the static keyword. I can see two function of the keyword static in conjunction with a data member of a class. 1. The data member...
4
by: Sam | last post by:
I'm thinking about this question. I've a class A and its member function fn. In fn there's a static variable s. If I create an object by A a; When I call the function a.fn, s would remain...
3
by: Lowen | last post by:
It's my understanding a static member variable will be one instance among all objects created from it, and static member functions only access static variables. When coding, I am still not sure how...
5
by: Richard Hayden | last post by:
Hi, I'm wondering if there is any order in the calling of global and static member objects' constructors which occurs before a C++ program can run. For example, what if I wish to use static...
4
by: Serge | last post by:
Hi, I have no problem creating a static member variable with integers, etc but when I try the same with a vector then I always get linker errors that the static member variable is unknown...
3
by: Tomás | last post by:
class Monkey { int cow() { static int k = 4; ++k; return k; }
5
by: John Goche | last post by:
Hello, I would like to know whethere there is a difference between a const variable and a static const variable inside a class. After all, if a variable is const in a class, the compiler can...
14
by: Jeroen | last post by:
Hi all, I've got a question about writing a library. Let me characterize that library by the following: * there is a class A which is available to the user * there is a class B that is used...
9
by: Jess | last post by:
Hello, I was told that if I declare a static class constant like this: class A{ static const int x = 10; }; then the above statement is a declaration rather than a definition. As I've...
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
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
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...
0
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,...
0
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...
0
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 ...

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.