PDA

View Full Version : Adding derived objects to a list dynamically



alizadeh91
19th October 2013, 12:07
Hi ...
I have a situation:
I have a abstract class from QObject and base class which is derivated from the abstract. There are approximately 30 classes which are derivated from the base class. These classes are all singleton and they will be constructed within project. I want to have list of these singleton objects always. I don't want to make hard code instead i want to save and access them from base class. I have tried to create a static list in base class and add objects to this list in constructor of base class but it fails and gives and error. I'm not much expert at object oriented design with combination of static members! If someone can help me i'll be appreciated.
Simplified form of class diagram is shown below:
9702
If i can have a static method to return list of derivated objects, that would be great but i don't know how?! May be it's one of design patterns which i don't know...

anda_skoa
19th October 2013, 15:59
So what is the error you are getting?

Cheers,
_