抱歉,我无法找到任何关键字来搜索此问题。我的代码在
之下#include <iostream>
using namespace std;
class Name {
public:
Name() {
cout << "Asif";
}
};
int main() {
Name obj(); // why Constructor not calling here?
return 0;
}
如果它没有调用构造函数,那么这段代码中正在运行什么进程?
答案 0 :(得分:3)
Name obj(); // why Constructor not calling here?
这是一个函数声明,返回一个Name对象
只做
Name obj;