   Returning values from a class. *UPDATE* Error1error C2039: 'x' : is not a member of"S
  *update* Apologies for sloppy code here is an update and an error I am recieveing help:)Hi thanks for looking and reading, also thanks to all who replied beforeI am attempting to return the subPosX and subPosY values. Below the class is my .cpp and main where I try to use the X and Y as the coordinates for a sprite.It all compiles but the sprite does not appear on the screen.Error1error C2039: 'x' : is not a member of 'Submarine'how do I fix this? what does it mean?Submarine class code and below is the code from the .cpp used to access the header.class Submarine {private:static int subPosX;static int subPosY;bool powerEmpty;int power;int distance;public:int setdistance(int);void setX(int x) { subPosX = x; }void setY(int y){subPosY;}int GetX(){return subPosX;}int GetY(){return subPosY;}Code used to access the headerstatic int x;static int y;//SubmarineSubmarine Lead;Lead.setX(150);Lead.setY(300);Lead.//Lead.GetX = x;//Lead.GetY = y;x = Lead.GetX();y = Lead.GetY();Full error I am getting:Error1error C2039: 'x' : is not a member of 'Submarine'c:\users\krups\desktop\uni\sub_game\sub\csci2605cwk\mainscroller3.cpp58[Edited by - g_m_t on April 8, 2010 2:11:08 PM]
void Submarine::setX(int SubX){    // Whoops!    // SubX = subPosX;    subPosX = SubX;};  I was tutoring a friend of mine in programming, and he used to do this kind of thing all the time, but exclusively in getters and setters. I always assumed it had something to do with his dyslexia, but I could never be certain, and now I have no idea.   ;  I don't know why you've made subPosX/Y private since the public modifiers you've provided don't do any special validation or processing. Just make those members public.Also, just another thing about style, it seems unnecessary to have the variable prefixed with "sub". It's a member of the "Submarine" class so any member of "Submarine" simply called "Position/Pos" will be interpreted by most people as "The position of this submarine".   