只想知道,为什么在调用构造函数时会出现冲突的声明错误?
class Base {
int a;
public:
Base() { a = 50; };
Base(int a): a(a) {
}
};
int main() {
int k = 20;
Base(k); // this should create a temp object right??
// i'm getting foll error "conflicting declaration ‘Base k’"
// why does compiler treat it has a declaration??
return 0;
}