I've started learning C++, I know C and Java already. I've started learning it because I want to start using object oriented programming.
However, I am stuck with code because compiler generates "undefined reference to vtable for Actor". Here you have code that generates same error, not the original one tho, because it would be less clear. I have really no idea what causes it.
struct Actor
{
int x, y;
virtual void move();
};
struct Player : Actor
{
Player(int a, int b)
{
x = a;
y = b;
}
void move();
void draw();
};
void Player::move()
{
++x;
};
main()
{
Actor *act;
act = new Player(10, 20);
}
This question may be dumb, I don't know, I've dug everywhere but found nothing that would solve my problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…