Skip to content

Instantly share code, notes, and snippets.

@yifu
Created March 1, 2012 08:58
Show Gist options
  • Save yifu/1948442 to your computer and use it in GitHub Desktop.
Save yifu/1948442 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class X {
public:
X() {
cout << "Constructor 1" << endl;
}
X(const X& h) {
cout << "Contsructor 2" << endl;
}
};
X test() {
X a;
cout << &a << endl;
return a;
}
int main() {
X b = test();
cout << &b << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment