class Foo
{
Foo() {};
~Foo() { Something really important happens here };
int somemember;
}
class Bar : public QDialog
{
//Some part of the Ui
Foo myFoo;
}
int main()
{
Bar b;
} // Bar autodestructs here, calling the Foo's destructor on b.myFoo automagically
Y2xhc3MgRm9vCnsKICBGb28oKSB7fTsKICB+Rm9vKCkgeyBTb21ldGhpbmcgcmVhbGx5IGltcG9ydGFudCBoYXBwZW5zIGhlcmUgfTsKICBpbnQgc29tZW1lbWJlcjsKfQoKY2xhc3MgQmFyIDogcHVibGljIFFEaWFsb2cKewogIC8vU29tZSBwYXJ0IG9mIHRoZSBVaQogIEZvbyBteUZvbzsKfQoKaW50IG1haW4oKQp7CgogICAgQmFyIGI7Cn0gLy8gQmFyIGF1dG9kZXN0cnVjdHMgaGVyZSwgY2FsbGluZyB0aGUgRm9vJ3MgZGVzdHJ1Y3RvciBvbiBiLm15Rm9vIGF1dG9tYWdpY2FsbHk=