Advertisement

Class Troubles

Started by April 28, 2001 10:41 AM
1 comment, last by JSCFaith 23 years, 9 months ago
Hey Well, I am having some problems with Inheritance of classes. Here are the two class I am having trouble with.
  

// GameObject.h ////////////////////////////////

#ifndef _CLASS_H_
#define _CLASS_H_

// Defines /////////////////////////////////////

#define TURNRIGHT 1
#define TURNLEFT 2

// Includes ////////////////////////////////////

#include "GameMain.h"
#include "ErrorTest.h"
#include <ddraw.h>
// Globals /////////////////////////////////////

// GameObject Class/////////////////////////////

class GameObject { // Base Class

	
public:
	GameObject() {
		x_pos = 0;
		y_pos = 0;
		Velocity_x = 1;
		Velocity_y = 1;
		Height = 60;
		Width = 60;
		HitPoints = 100;

	}
	
	// Moves Object

	inline void Move();
	// Draw Object

	virtual int Draw(LPDIRECTDRAWSURFACE7 PrimarySurface, LPDIRECTDRAWSURFACE7 SourceSurface);
	// Sets Object Position

	inline void SetPosition(int X_Pos, int Y_Pos);
	// Change Object''s Velocity

	inline void ChangeVelocity(int NewX, int NewY);
	// Change Object''s HitPoints

	inline void ChangeHitPoints(int NewHP);


	// Animation Functions


	// Next Frame

	int ChangFrame();
	// Sets Frame

	void SetFrame(int Frame);

	
protected:

	// Linked List Variables

	static GameObject *pFirst;
	GameObject *pNext;

	// GameObject Variables

	int x_pos;
	int y_pos;
	int HitPoints;
	int Velocity_x;
	int Velocity_y;
	int Height;
	int Width;

	//Animation Variables

	int CurrentFrame;
	int NextFrame;

	// Protected Member Functions


	// Destroys Object with Explosion

	virtual void Explode(int Explosion);

};

// Class Asteroids//////////////////////////////


class Asteroid : public GameObject { // Inherits stuff of GameObject


public:

	Asteroid() {
	
	}
	
    int Draw(LPDIRECTDRAWSURFACE7 PrimarySurface, LPDIRECTDRAWSURFACE7 SourceSurface);

protected:

	// Explode

	void Explode(int Explosion);
		
};

#endif
// End /////////////////////////////////////////


  
Well you would think this would work. Ok, well, in the GameLoop, I create a Asteroid Object, Asteroid Asteroid1; Now, when I try to call it like this: Asteroid1.Move(); I get this error: unresolved external symbol "public: void __thiscall GameObject::Move(void)" (?Move@GameObject@@QAEXXZ) That happens with any function except Draw, and Explode. I don''t understand why this is. Both classs are in the same .h file, so they know eacher exist I belive. Well if someone could help I would appreciate that. Thanks James,
Well, unresolved external symbol in this case means that it''s not finding any implementation for the Move() function. You have an implementation for it?

// CHRIS
// CHRIS [win32mfc]
Advertisement
LNK2001 is my mortal enemy.

This topic is closed to new replies.

Advertisement