I don't see an error in the code you posted. That means that the error is somewhere else. A typo, perhaps? Maybe your function definition doesn't have "ObjectDatabase::" in front of the name?

If that doesn't help, could you copy/paste the code where you try to access the variable?