0
class A{
public:
    A(){    cout<<"A";    }
    A(int x){    cout<<x;    }
    ~A(){    cout<<"bye";    }
};

int main(){
 A obj1;
 A obj2();
 A obj3=5;
}

The output is A5byebye. Why is default constructor not called when obj2 is instantiated? What does A obj2(); line exactly do?

jaco0646
  • 13,332
  • 7
  • 54
  • 75

0 Answers0