I'd like to pass a class's variable as a parameter to one of that class's methods, but I get an error that says "A reference to a non-static member must be relative to a specific object".
class myClass
{
private:
  int x = 1;
public:
  void func(int pos = x)
  {
    //whatever
  }
};
I'd like to make it so that if a parameter is passed when the method is called then that's the one used to initialize pos, otherwise x is used.
I tried looking for solutions but wasn't able to find anything. Any help is really appreciated.
 
     
    