#include #include #include #include #include "Example.h" using namespace std; //-------------------------------------- // The mainline/app. // All this one tries to do is to show // when destruction take place. //-------------------------------------- Example sub(Example ex) { return ex; } int main(int argc, char* argv[]) { // Here's a local object. It will be deleted when we leave // this scope. cout << "\nLocal object:" << endl; Example local("local"); // Here's the most complicated example, and one that's surprisingly // hard to get right. cout << "\nFunction call, return, assign:" << endl; Example returnedVal("return val"); returnedVal = sub(local); }