const char VS global char
I apologize if this appears twice. The first time I tried to post my computer froze and I had to reboot. I didn't see it posted anywhere so I am trying to post it again.
I have the following code:
Code:
//******************************************
//CONSTANT
const char ERROR1 []= "You have an invalid selection";
//******************************************
//CLASS DECLARATION
class ArrayException : public exception
{
public:
char * what();
ArrayException(char[]);
private:
char *message;
};
//*****************************************
//CONSTRUCTOR
ArrayException::ArrayException(char errorMessage [])
{
message = errorMessage;
}
In my main I am calling
ArrayException(ERROR1)
My compiler is giving me the following error;
error C2440: 'initializing' : cannot convert from 'char [44]' to 'const char *[]
If I change my constant variable to a global variable everything works just fine. I would like to use the constant variable if possible.
Any sugestions?
Thanks,