#include <cstring>
public:
Bar(const char* _name) {
cout << "ctor" << endl;
strcpy(name, _name);
}
Bar(const Bar& other) {
cout << "cp ctor" << endl;
strcpy(name, other.name);
}
virtual ~Bar() {
cout << "dtor" << endl;
}
return name;
}
strcpy(name, _name);
}
char name[256];
};
return Bar("bar");
}
Bar bar(foo());
cout << foo().getName() << endl;
return 0;
}
ctor
bar
dtor
dtor
993




被折叠的 条评论
为什么被折叠?



