How to create multiple instances of a static members?

Andreas Pakulat apaku at gmx.de
Sat Feb 11 20:03:02 GMT 2006


On 12.02.06 00:49:03, kitts wrote:
> On Saturday 11 February 2006 17:08 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. 

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.

In static member functions there is no this-pointer.

Andreas

-- 
Excellent day for putting Slinkies on an escalator.

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



More information about the KDevelop mailing list