I am not able to Invoke 'explicit a (string x)' using the object a3, I got two compilation errors such as:
[Error] invalid conversion from 'const char*' to 'int' [-fpermissive]
[Error] initializing argument 1 of 'a::a(int)' [-fpermissive]
My expected out put is 'int int double string';
Could somebody help me to remove these errors? Thanks for your valuble time.
#include<iostream>
#include<string.h>
using namespace std;
struct a{
a(int x=0){cout<<" int ";
}
inline a (double x){cout<<" double ";
}
explicit a (string x){ cout<<" string ";
}
};
int main()
{
a a0(NULL);
a a1=9;
a a2=1.1;
a a3=("Widf"); //Error
}