   error C2039: 'x' : is not a member of 'Submarine'
  I am getting this error when I try to return the x and y positions of the sub I have posted my class and the code used to call along with the full error message, thanks to all who look.I have marked where the error points to in the code with >>Quick bit of background, the ints will be used as the coordinates for a sprite.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; }This is how I am calling the ints static int x; static int y; //Submarine Submarine Lead; Lead.setX(150); Lead.setY(300);  >>  x = Lead.GetX(); y = Lead.GetY();This is the full errorError 1 error C2039: 'x' : is not a member of 'Submarine' c:\users\krups\desktop\uni\sub_game\sub\csci2605cwk\mainscroller3.cpp 58   
Why are Submarine::subPosX and Submarine::subPosY static?  Do you really want only one subPosX and subPosY shared between all instances of Submarine?Why do you have subPosY and subPosX private?  If you have a get/set pair that don't do anything special, why not make the members public?Please use [source][/source] tags to post source code.Please post a minimal demonstration of the problem, because the code below compiles without any errors for me: 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;}};int main() {static int x;static int y;//SubmarineSubmarine Lead;Lead.setX(150);Lead.setY(300);x = Lead.GetX();y = Lead.GetY();}EDIT:Please post the exact code that you're compiling; I just noticed the edit from your other thread.  The code you posted here, and the code you posted on the other thread are mismatched:static 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();Look carefully, the code colored red is one statement.[Edited by - _fastcall on April 8, 2010 3:15:02 PM];  Apologies I am new to this site and Thanks for the help.I have made several changes, as I keep recieving help which is womderful and I am thankful for.I have the setX and setY working and the getX and getY appear to be working as well however I need to change them as they are the x/y positions for a sprite and i need to be able to change them, but they need to retain there value through a game loop.Thanks once again=]   ;  Post your current code if you'd like more feedback. I'd like to be sure you've made the variables non-static in particular, that will appear to work when tested with one Submarine instances but you'll see strange behaviour when you create two or more.   ;  I intend to delete this thread as I have now moved on, if you are interested then please follow this http://www.gamedev.net/community/forums/topic.asp?topic_id=567663it is another more recent thread with updated code =]thanks for helping   ;  Just a note - don't delete threads.  Leave them there for other people who may have encountered the same problem.   ;  I think we're done here, then.   