In C++, if you pass an anonymous object as an argument to a named object method, does the anonymous object get deleted when you delete the named object?
The library I'm using for a project expects pointers to objects for most of its own objects' methods, a la:
WContainerWidget::addWidget(WContainerWidget* widget) {/*...*/}
and in their examples they often use the new operator when constructing these objects.
WContainerWidget* aFoo = new WConainerWidget(/*args*/);
aFoo->addWidget(new WText(/*args*/));
If I delete aFoo, will the anonymous WText() object be deleted?
Am I to trust that their implementation will take care of these deletions without sorting through their source code, or should I avoid the exemplified behaviour, and explicitly name/delete everything myself?
http://www.webtoolkit.eu/wt/doc/reference/html/overview.htmlWhen inserting a widget in the widget hierarchy, ownership is transferred to its parent in the tree.