The below is just a brief part of my code. And when I run it, it gives me the warning that ISO C++ forbids converting string to char* for visual studio code and exits with code 1. Is there a way I can ignore the warning to run the code?
Class Airport
{
public:
Airport(char *code, char *name);
}
Airport::Airport(char *code, char *name)
{
airport_code = new char[20];
strcpy(airport_code, code);
airport_name = new char[20];
strcpy(airport_name, name);
}
int main() {
Airport *lax = new Airport("LAX", "LA");
}
I saw on other stackoverflow posts that changing char to const char will solve the problem. But because the values will need to be changed using other predefined functions, it won't be the answer that I need.