All,
I have defined a bunch a enums in a standard header file (outside of an
object) that I want to share across objects. I thought the right
approach would be to create the definitions globally, but then create
the instances in each of the objects that needs to use them. However
this is causing me a problem. I thought I could use the scope
identifier, but guess not. What I was trying was this:(compiler told
me it was undefined).
In .h header outside of any objects
enum myEnum
{
Item1,
Item2
} ;
Then in my object where I want to use it:
Object1::MyMethod()
{
myEnum passVal; // local instance
MyMethod2(passVal::Item1); // this causes the problem.....
}
Object1::MyMethod2(myEnum eVal)
{
Object2 obj;
obj(eVal); //object 2 would also need to
know, so I had put the definitions in
// common header ?
}
Is there another way to do this (or should I just go back and use
constants) ?
Thanks,
Mark