Predict the output of following program?
#include <iostream>
using namespace std;
class Test
{
private:
int x;
public:
Test(int i)
{
x = i;
cout << "Called" << endl;
}
};
int main()
{
Test t(20);
t = 30; // conversion constructor is called here.
return 0;
}
Compiler Error
Called
Called
Called
This question is part of this quiz :
C++ Constructors