There is a function isInstruction() in my code (not mine) which is used for setting and getting a member with no problem. Now I added my own function for similar purpose state(). Like this:
struct foo { bool & isInstruction() { return isInst; // no problem } int & state() { return state; //ERROR } private: bool isInst; int state; }; I have no problem with the first function. But for the second one, I get
error: invalid initialization of reference of type ‘int&’ from expression of type ‘<unresolved overloaded function type>’ Then question is what is the difference between these two functions. Am I missing something?