static member variable for group of objects

P

pramod

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
 
T

Thomas Wintschel

pramod said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top