I'm working on c++, following is my template class:
namespace My{
template<class config>
class BasicValue
{
public:
enum Type
{
NULL_TYPE = 0,
OBJECT_TYPE,
ARRAY_TYPE,
STRING_TYPE,
BOOL_TYPE,
INT_TYPE,
REAL_TYPE,
}; // Type
};// BasicValue
}// My
Now, Im accessing this "Type" enum from another .cpp file. Im getting following compilation error for all enum types:
error: ‘STRING_TYPE’ was not declared in this scope
How I can use this enum outside the "My" namespace?
Following is the code usage, Im using the enum value in switch case:
void printValue(const Value& val, int space)
{
int sp = space;
switch(val.type())
{
case STRING_TYPE:
break;
case BOOL_TYPE:
break;
case INT_TYPE:
break;
case REAL_TYPE:
break;
default:
exit(-1);
}
}