Hey.
I have an ABC 'Object3D' and one derived class 'MobileObject3D' with an extra public method 'setAcceleration' that isn't defined in the ABC.
Because of this i'm getting the following error: ".cpp|69|error: 'class Object3D' has no member named 'setAcceleration'|"
I thought i was able access the public methods of the derived classes, but it seems i cannot.. why is that? Isn't polymorphism similar to inheritance?
Object3D.h
class Object3D
{
public:
Object3D( const unsigned int quad_num );
virtual ~Object3D();
virtual void BuildRectSolid( const Vertex3 origin, const float width, const float height, const float depth, const unsigned char color_id ) = 0;
virtual void Build() = 0;
virtual void Render() = 0;
Mesh *mesh;
protected:
GLint DL; // DL
GLfloat *vertices; // VA
GLubyte *indices; // VA
GLfloat *color; // VA
};
MobileObject3D.h
class MobileObject3D : public Object3D
{
public:
MobileObject3D( const unsigned int quad_num );
~MobileObject3D();
void setAcceleration( const GLfloat accel );
void BuildRectSolid( const Vertex3 origin, const float width, const float height, const float depth, const unsigned char color_id );
//void Move();
void Build();
void Render();
Vertex3 coords;
GLfloat w, h, d;
GLfloat acceleration;
private:
void NextFrame();
};
main.cpp
// test mobile cube
cube = new MobileObject3D( 0 );
cube->setAcceleration( 0.2 );
cube->BuildRectSolid( tmp, 10, 10, 10, 1 );
ty