Response to: dynamic array of interfaces
Revision 1
Solution using std::vector...
Declare this somewhere
std::vector<myinterface> InterfaceList;</myinterface>
Too add an interface...
MyInterface *pNewInterface;
pNewInterface = new MyClass;
if (pNewInterface )
push_back(pNewInterface);
}
To iterate through the interfaces
size_t n = InterfaceList.size();
for (size_t i=0; i < n; i++) {
InterfaceList[i]->myFunction();
}
Then to delete them later...
size_t n = InterfaceList.size();
for (size_t i=0; i < n; i++) {
delete InterfaceList[i];
}
InterfaceList.clear();
Posted 21-Sep-12 8:29am
by
JackDingler.