08.11.2014 Views

Memory Management - Poco

Memory Management - Poco

Memory Management - Poco

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

int main(int argc, char** argv)<br />

{<br />

DynamicFactory factory;<br />

factory.registerClass("A"); // creates Instantiator<br />

factory.registerClass("B"); // creates Instantiator<br />

SharedPtr pA = factory.createInstance("A");<br />

SharedPtr pB = factory.createInstance("B");<br />

// you can unregister classes<br />

factory.unregisterClass("B");<br />

// you can also check for the existence of a class<br />

bool haveA = factory.isClass("A"); // true<br />

bool haveB = factory.isClass("B"); // false (unregistered)<br />

bool haveC = factory.isClass("C"); // false (never registered)<br />

}<br />

return 0;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!