How to create multiple instances of a static members?

Andreas Pakulat apaku at
Sat Feb 11 11:38:51 GMT 2006

On 11.02.06 12:04:57, kitts wrote:
> Hi All,
> I am new to developing in KDE and don't have much experience with C++ 
> itself, so please excuse my naiveness.
> I would like to know how i can create multiple instances of a class which 
> has static members, such that the static members too are instantiated?

Then they're not static members, but instance members and thus you don't
need static members. The whole point of static class members is to have
them available when there is no instance of that class.

> My program is structured as a trees of objects. The objects within each tree 
> are allowed to instantiate the special class. However, i want the static 
> objects of this special class to be instantiated only once for each tree.

Then static is the right choice and I don't understand your problem.

> I also have a static slot fucntion which i want to "connect" to when the 
> first instance in a given tree is created.

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. 

If you want to be notified when the first instance of the tree is
created emit a signal in the function that does this.


You had some happiness once, but your parents moved away, and you had to
leave it behind.

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