Deriving from a interface errors, dont quite understand

This error is annoying, Im kinda new to this design please help:

error C2061: syntax error : identifier 'GameObject'
InputComponent::Update' : function does not take 1 arguments

error C2259: 'PlayerInputComponent' : cannot instantiate abstract class
1> due to following members:
1> 'void InputComponent::Update(void)' : is abstract

InputComponent:
1
2
3
4
5
6
7
#pragma once
#include "GameObject.h"
class InputComponent
{
public:
	virtual void Update(GameObject &obj) = 0;
};


PlayerInputComponent:
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once
#include "InputComponent.h"
#include "GameObject.h"
class PlayerInputComponent : public InputComponent
{
public:
	virtual void Update(GameObject &obj)
	{
		//Check input here..
	}
private:
};


GameObject:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include "InputComponent.h"
#include "PhysicsComponent.h"
#include "RenderComponent.h"
class GameObject
{
public:
	int x, y;
	int velocity;

	GameObject(InputComponent *input, PhysicsComponent *physics, RenderComponent *render) 
		: input_(input), 
		physics_(physics),
		render_(render) {};

	virtual void Update()
	{
		input_->Update(*this);
		physics_->Update(*this);
		render_->Update(*this);
	}

private:
	InputComponent *input_;
	PhysicsComponent *physics_;
	RenderComponent *render_;
	
};



Any help would be great
Last edited on
I don't immediately see anything wrong in any of that code you've posted. Could there be something wrong in one of the header files included by GameObject.h?
Here are all my .h i am using (btw everything is in .h not .cpp aswell, i did this quickly just to see if what i code compiles:

Here is the header for a Physics Component, it has no code just the basic structure, also each .h are the same apart from the naming obviously:

1
2
3
4
5
6
7
#pragma once
#include "GameObject.h"
class PhysicsComponent
{
public:
	virtual void Update(GameObject &obj) = 0;
};


1
2
3
4
5
6
7
8
9
10
11
#pragma once
#include "PhysicsComponent.h"
#include "GameObject.h"
class PlayerPhysicsComponent : public PhysicsComponent
{
public:
	virtual void Update(GameObject &obj)
	{
		//Do physics here..
	}
};



i give up.. -_- never coming back to these forums
Wow. You waited a whole 24 minutes before flouncing out.

:rolleyes:
closed account (D80DSL3A)
Does this mean that the guy who went to some effort to help in your duplicate thread here http://www.cplusplus.com/forum/beginner/99500/#msg535139 totally wasted his time?
he posted after i posted this i think or maybe as i were writing this.. if you were in my shoes you'd understand lmao, plus i think ill stick to other forums as i cant be waiting hours for a reply..
Topic archived. No new replies allowed.