How to create multiple instances of a static members?

kitts kitts at
Sat Feb 11 20:35:46 GMT 2006

On Sunday 12 February 2006 01:33 IST, Andreas Pakulat wrote:
>  > Then static is the right choice and I don't understand your problem.
> >
> > Actually, the way i was looking at it was that; within one process, i
> > have one or more sets of a class's objects. Within each of these sets i
> > want some static objects that remain common to all, however, i do not
> > want these static members across sets.
> There's no real "static" objects needed in what you describe. static
> members (either variables or functions) are needed if your class
> provides functionality that is not bound to a specific instance.

I don't think i understand that fully. How would i maintain information of 
say, how many instances are present in one set? and if a member variable 
were updated by any one instance, the same be reflected in all other 
instances. all this while each instance does not directly know of the 
others existence?

May be i need to read a lil more on basic concepts.

> All you need is a class that models a set, which apart from a list of
> contained objects also has this "special" object.
> > > Huh? That won't work I think. You can't connect a signal just to a
> > > function, you need an object and then it's already there.
> >
> > From the documentation of QObject, i find two prototypes;
> >
> > bool QObject::connect ( const QObject * sender, const char * signal,
> > const QObject * receiver, const char * member ) [static]
> >
> > and
> >
> > bool QObject::connect ( const QObject * sender, const char * signal,
> > const char * member ) const
> >
> > I think the second handles this situation.
> No, did you read the description of it? It automatically uses "this" as
> the receiver, which means you'd call that from a non-static member
> function (or the constructor) of a class.

Gosh! I missed that! I read the documentation against the first and was then 
just happy to not see the receiver object in the second.

This is not a problem however, as there was no real need to make that a 
static member function. The thing is that it updates some static member 
variables as i need this to be seen by all instances.

to unsubscribe from this list send an email to kdevelop-request at with the following body:
unsubscribe »your-email-address«

More information about the KDevelop mailing list