Scenario: There is an interface. Sub-classes implement this interface. There is a manager that should iterate through these sub-classes and issue commands, etc.
Problem: How is it possible to register these sub-classes to the manager at compile time?
I have tried doing something like:
Expand|Select|Wrap|Line Numbers
- typedef struct List {
- Interface * subclass;
- } List;
- List classes[] = {
- new Subclass1();
- new Subclass2();
- };
Thanks.