How would constructor be call in this code ?
Neither x()
is called nor x(int i = 0)
is called in this code. Could not make how the constructor is being called.
# include <iostream>
using namespace std;
class x
{
int value;
public:
x(){
value = 0;
cout<<"Hello"<<endl;
}
x(int i = 0){
value = i;
cout<<"Bye"<<endl;
}
};
int main(){
x a();
return 0 ;
}
Output is neither "Hello" nor "Bye".