I write the code like this
class A{
// ...
public:
insert(int key, char* contents){ ... }
}
and want to use
A.insert(1, "hellow world");
but does not allow conversion from string literal to char*
how can use like this way?
I write the code like this
class A{
// ...
public:
insert(int key, char* contents){ ... }
}
and want to use
A.insert(1, "hellow world");
but does not allow conversion from string literal to char*
how can use like this way?
A string literal is a const char*
.
class A{
// ...
public:
insert(int key, const char* contents){ ... }
}
// ...
A.insert(1, "hello world");