Why is the constructor H1
and H2
getting called? Can I get the reason?
class A
{
public:
int a;
char b;
A()
{
a = 0;
b = '\n';
}
A(int a)
{
cout << "H1";
}
A(char c)
{
cout << "H2";
}
};
int main()
{
int a = 10;
char c = 'h';
A ob1 = a;
ob1 = c;
}