I am wandering the desert of my brain.
I'm trying to write something like the following:
class MyClass {
// Peripherally Related Stuff
public:
void TakeAnAction(int oneThing, int anotherThing) {
switch(oneThing){
case THING_A:
TakeThisActionWith(anotherThing);
break;
//cases THINGS_NOT_A:
};
};
private:
void TakeThisActionWith(int thing) {
string outcome = new string;
outcome = LookUpOutcome(thing);
// Do some stuff based on outcome
return;
}
string LookUpOutcome(int key) {
string oc = new string;
oc = MyPrivateMap[key];
return oc;
}
map<int, string> MyPrivateMap;
Then in the .cc file where I am actually using these things, while compiling the TakeAnAction section, it [CC, the solaris compiler] throws an an error: 'The function LookUpOutcome must have a prototype' and bombs out.
In my header file, I have declared 'string LookUpOutcome(int key);' in the private section of the class.
I have tried all sorts of variations. I tried to use 'this' for a little while, and it gave me 'Can only use this in non-static member function.' Sadly, I haven't declared anything static and these are all, putatively, member functions. I tried it [on TakeAnAction and LookUp] when I got the error, but I got something like, 'Can't access MyPrivateMap from LookUp'.
MyPrivateMap could be made public and I could refer to it directly, I guess, but my sensibility says that is not the right way to go about this [that means that namespace scoped helper functions are out, I think]. I also guess I could just inline the lookup and subsequent other stuff, but my line-o-meter goes on tilt. I'm trying desperately not to kludge it.