临时对象
// // @data 16-1-5 上午12:34 // #include <iostream> using namespace std; class Test { public: Test(const string & name,const int &age) : name(name),age(age){ // no op } const string &name; const int &age; }; int main(int argc, char *argv[]) { Test t1 = Test("hello",12); Test t2 = Test("world",13); cout << t1.name << "," << t2.name << endl; cout << &t1.name << "," << &t2.name << endl; cout << t1.age << "," << t2.age << endl; return 0; }
world,world
0x7ffddff63c60,0x7ffddff63c60
-537510816,13