non-class type error

I have a class called player which includes an object of a class called MotionData.

class Player
{
  public:
    Player();
    MotionData motionData; // <---------------- object declaration
    Point ScreenMin;
    Point ScreenMax;
    int Score;
    byte Health;
    byte Lives;
    byte Image;
    byte bytMoveCounter = 0;
    byte bytMoveCounterMax = 2;
    Bullet bullet;
};

Player::Player()
  :
  ScreenMin(3, 1),
  ScreenMax(7, 2),
  Image(0),
  Score(0),
  Health(100),
  Lives(3),
  bullet()
  {
};
[\code]

and I've declared the class MotionData earlier in the same file.  MotionData has nothing to do with the enumerated type enuMapData but i still get this unusual error message when it refuses to compile.


request for member 'motionData' in 'player', which is of non-class type 'enuMapData'

at a line of code 
[code]
player.motionData.ScreenLocPrev_Set(ptPlayerScreenLoc);
[\code]
 
near the end of the file.  and its a bit of a mystery to me why it even mentions 'enuMapData' with regards to the motionData call.

Post your code.

its a large file … but here’s some of the MotionData which inherits classBitHandler.
classBitHandler manipulates the bits of an unsigned long integer to compress data into 32 bit collections as seen in the first two methods of the MotionData class which sets/gets the Point(byte,byte) value of a value call Loc[ation]. the map size is 32/32 so 5 bits are used for y[0-4] and 5 bits for x[5-9].

class classBitHandler
{
  public:
    byte getByte(const unsigned long *ulngData, byte bytBitStart, byte bytBitEnd);
    void setBits(unsigned long *ulngData, byte bytBitStart, byte bytBitEnd, byte bytDataIn);
};



byte classBitHandler::getByte(const unsigned long *ulngData, byte bytBitStart, byte bytBitEnd)
{
  unsigned long ulngTemp = *ulngData >> bytBitStart;

  byte bytTemp = 0;
  byte bytNumBits = bytBitEnd - bytBitStart + 1;

  for (byte bytCounter = 0; bytCounter < bytNumBits; bytCounter ++)
  {
    if (ulngTemp % 2 == 1)
      bytTemp += (1 << bytCounter);

    ulngTemp = ulngTemp >> 1;
  }
  return bytTemp;
}

void classBitHandler::setBits(unsigned long *ulngData, byte bytBitStart, byte bytBitEnd, byte bytDataIn)
{
  unsigned long ulngRetVal = *ulngData;
  for (short shCounter = 0; shCounter < 32; shCounter ++)
  {
    bool bolShiftIn = false;
    if (shCounter >= bytBitStart && shCounter <= bytBitEnd)
    {
      bolShiftIn = (bytDataIn % 2) == 1;
      bytDataIn = bytDataIn >> 1;
    }
    else
    {
      bolShiftIn = (ulngRetVal % 2) == 1;
    }

    ulngRetVal = ulngRetVal >> 1;

    if (bolShiftIn)
      ulngRetVal = ulngRetVal + ((unsigned long)1 << 31);
  }

  *ulngData = ulngRetVal;
}

/*
   uses 32 bit unsigned long integer to store :
                bits 0-4          Map Current Location Y              (range from 0-31)
                bits 5-9          Map Current Location X              (range from 0-31)
                bits 10-14        Map Previous Location Y             (range from 0-31)
                bits 15-19        Map Previous Location X             (range from 0-31)
                bits 20, 21       Screen Current Location Y           (range from 0-3)
                bits 22, 23, 24   Screen Current Location X           (range from 0-7)
                bits 25, 26       Screen Previous Location Y          (range from 0-3)
                bits 27, 28, 29   Screen Previous Location X          (range from 0-7)
                bits 30, 31       direction of motion where 00 = Left, 01 = right, 10 = up & 11= down
*/
class MotionData: classBitHandler
{
  public :
    MotionData();
    Point Loc_Get();
    void Loc_Set(Point ptLocNew);

    Point LocPrev_Get();
    void LocPrev_Set(Point ptLocPrevNew);

    Point ScreenLoc_Get();
    void ScreenLoc_Set(Point ptScreenLocNew);

    Point ScreenLocPrev_Get();
    void ScreenLocPrev_Set(Point ptScreenLocPrevNew);

    byte Dir_Get();
    void Dir_Set(byte bytDirNew);

    unsigned long ulngData;

  private:
};

MotionData::MotionData() {}

Point MotionData::Loc_Get()
{
  byte bytX = MotionData::getByte(&ulngData, 5, 9);
  byte bytY = MotionData::getByte(&ulngData, 0, 4);
  return Point(bytX, bytY);
};

void MotionData::Loc_Set(Point ptLocNew)
{
  MotionData::setBits(&ulngData, 5, 9, ptLocNew.X);
  MotionData::setBits(&ulngData, 0, 4, ptLocNew.Y);
}

you can see the player def’n in the previous post and its declaration is

Player player;
[\code]

but the problem is when I try to use the motionData object inside the player object such as 

[code]
player.motionData.ScreenLocPrev_Set(ptPlayerScreenLoc);

which is virtually identical to Loc_Set() except the bits sent to classBitHandler’s setBits() function which are described in the commented MotionData description above [25-26 & 27-29] (2 bits to describe the 4 lines available in my 1604 lcd and 3 bits to describe the half width of that same screen)

i don’t understand why the IDE is even mentioning the enumerated type enuMapData in the error I get when I try to compile

request for member ‘motionData’ in ‘player’, which is of non-class type ‘enuMapData’

?

got it...
not shown in the code above but the enumerated class has an element named 'player' which conflicts which the Player class instance 'player'.

I'll know what to look for next time.