Original Post
Hey, I''m making an ERROR class.
And I would want calls like this be possible:
//I would want this syntax to work, but I''m getting errors:
ERROR result = someFunc(...);
//this doesn''t work
//Error: Cannot convert from char[x] to ERROR&
ERROR& someFunc(...) {
return "TEST_ERROR"
}
//ERROR is a class
class ERROR {
public:
char* err_message;
char* err_message_detailed;
ERROR& operator=(const char* error_UserId) {
...
//I seach through a map for error_UserId,
//and result gets a pointer to an ERROR object
ERROR* result = findError(error_UserId);
//Then I assign this objects variables to the
//ones that the ERROR object corresponding to
//error_UserId
err_message = result->err_message;
err_message_detailed = result->err_message_detailed;
//then I return the new object...
return *result;
}
//...
}
Do you guys get what I mean?
So far I have managed this syntax to be possible:
//this works fine... ERROR result; result = "TEST_ERROR"; //But the one in the source block above with the someFunc //doesn''t work. //I believe it has something to do with that ERROR result //cannot be initialized to a char* type. But even if I am right //I still don''t know how to make my goal possibleThx, appreciate it