M
Mark
Hi,
I'm trying to write some classes that kind of manage themselves. A
linked list, that links different types of objects. Here's the code...
object.h:
---
class Object
{
int alt;
public:
Object *next;
Object();
virtual void draw() = 0;
};
class Projectile : public Object
{
double x, y;
double vel, dir;
public:
Projectile(double,double,double,double);
void draw();
};
object.cpp
---
#include "object.h"
Object *list = NULL;
Object::Object()
{
next = list;
list = this;
printf("object constructor got called\n");
}
Projectile:
rojectile(double x, double y, double vel, double dir)
: x(x), y(y), vel(vel), dir(dir)
{
printf("projectile constructor got called\n");
}
void Projectile::draw()
{
drawDisk((int)x,(int)y,4,ColorRGB(255,0,0));
}
This linker error appears 4 times,
[Linker error] undefined reference to `vtable for Object'
And I'm not sure how to fix it. Any help?
I'm trying to write some classes that kind of manage themselves. A
linked list, that links different types of objects. Here's the code...
object.h:
---
class Object
{
int alt;
public:
Object *next;
Object();
virtual void draw() = 0;
};
class Projectile : public Object
{
double x, y;
double vel, dir;
public:
Projectile(double,double,double,double);
void draw();
};
object.cpp
---
#include "object.h"
Object *list = NULL;
Object::Object()
{
next = list;
list = this;
printf("object constructor got called\n");
}
Projectile:
: x(x), y(y), vel(vel), dir(dir)
{
printf("projectile constructor got called\n");
}
void Projectile::draw()
{
drawDisk((int)x,(int)y,4,ColorRGB(255,0,0));
}
This linker error appears 4 times,
[Linker error] undefined reference to `vtable for Object'
And I'm not sure how to fix it. Any help?