I continue the game for the built-in microcontroller (Arduino), and I have a question about the interaction of classes - this question continues from my previous question here and I based my code on the sheddenizen sentence (see the answer to the link in "here"):
I have three classes that inherit from the base class -
(i) Sprite class - (bass class) has a raster shape and (x, y) position on the LCD
(ii) class Missile: public Sprite - has a specific form (x, y), and also takes an obj object
(iii) class Alien: public Sprite - has a specific form and (x, y)
(iv) Player class: public Sprite - ""
They all have different (virtual) moving methods and are displayed on the LCD:

- , , : (x, y), ?
class Sprite
{
public:
Sprite(unsigned char * const spacePtrIn, unsigned int xInit, unsigned int yInit);
virtual void Move() = 0;
void Render() { display.drawBitmap(x,y, spacePtr, 5, 6, BLACK); }
unsigned int X() const { return x; }
unsigned int Y() const { return y; }
protected:
unsigned char *spacePtr;
unsigned int x, y;
};
Sprite::Sprite(unsigned char * const spacePtrIn, unsigned int xInit, unsigned int yInit)
{
x = xInit;
y = yInit;
spacePtr = spacePtrIn;
}
class Missile : public Sprite
{
public:
Missile(Sprite const &launchPoint): Sprite(&spaceMissile[0], launchPoint.X(), launchPoint.Y()) {}
virtual void Move();
};
void Missile::Move()
{
y++;
Render();
}
Player HERO;
Alien MONSTER;
Missile FIRE(MONSTER);
HERO.Move();
MONSTER.Move();
FIRE.Move();