I have seen many post regarding explicit keyword but no where find the answer for why its failing. I have seen other post in stack overflow also but Regarding the conversion its very confusing kind of explanation given
class Foo {
public:
explicit Foo(int x);
};
int main()
{
Foo a = 42; //Compile-time error
Foo b(42); //OK: calls Foo::Foo(int) passing 42 as an argument
}
what exactly happening when we are writing Foo a = 42;
, and how its differ from Foo b(42);