Hi,
Is it possible a implicit cast from const char * to bool?
With this program:
class Foo
{
public:
pru (string param){ cout <<"string"<<end l;}
pru (bool param){ cout <<"bool";<<endl }
};
int main()
{
pru * p1=new pru("string");
string pp = "string";
pru * p2=new pru(pp);
pru * p3=new pru(true);
}
I get this results:
bool
string
bool
So in the first new, when I pass a const char type the compiler is making a implicit cast to bool. Anybody can give me an explanation?
TIA.
Jose.
Is it possible a implicit cast from const char * to bool?
With this program:
class Foo
{
public:
pru (string param){ cout <<"string"<<end l;}
pru (bool param){ cout <<"bool";<<endl }
};
int main()
{
pru * p1=new pru("string");
string pp = "string";
pru * p2=new pru(pp);
pru * p3=new pru(true);
}
I get this results:
bool
string
bool
So in the first new, when I pass a const char type the compiler is making a implicit cast to bool. Anybody can give me an explanation?
TIA.
Jose.
Comment