ok i have tried to inline the constructor in the subclass decleration and tried also in a seperate .cpp file here are the actual classes if this helps
Code:
class Gameobject
{
public: //in Gameobject.h
Gameobject(int x,int y,int w,int h,int xp,int yp,SDL_Rect cp);
virtual ~Gameobject();
SDL_Rect box,clip;
int xpos,ypos;
void show(SDL_Surface* src,SDL_Surface* dest);
};
class Ball : Gameobject
{
public: //in Ball.h
~Ball();
Ball(int x,int y,int w,int h,int xp,int yp,SDL_Rect cp);
int xvel;
int yvel;
void move();
void update();
};
Gameobject::Gameobject(int x, int y, int w, int h,int xp,int yp,SDL_Rect cp)
{
box.x=x; //in Gameobject.cpp
box.y=y;
box.w=w;
box.h=h;
xpos=xp;
ypos=yp;
clip.h=cp.h;
clip.w=cp.w;
clip.x=cp.x;
clip.y=cp.y;
}
Ball::Ball(int x,int y,int w,int h,int xp,int yp,SDL_Rect cp):Gameobject(x,y,w,h,xp,yp,cp)
{
xvel=0; // in Ball.cpp
yvel=0;
};
i hope this helps i have tried a few things but cant get it to compile i am trying to create a Gameobject class that all objects for my game can inherit from i know this is a more complex way to make my game but i feel i can learn alot doing it this way thanks again in advance