Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


Component.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef COMPONENT_H_
#define COMPONENT_H_

class Entity;

class Component {
private:
	Entity* parentPtr;

public:
	virtual void update() = 0;
	void setParent(Entity* mParentPtr);
};

#endif /* COMPONENT_H_ */

Component.cpp

1
2
3
4
#include "Component.h"

void Component::setParent(Entity* mParentPtr) { parentPtr = mParentPtr; }
void Component::update() { }

Entity.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef ENTITY_H_
#define ENTITY_H_

#include <vector>

class Component;

class Entity {
private:
	std::vector<Component*> componentPtrs;

public:
	void update();
};

#endif /* ENTITY_H_ */

Entity.cpp

1
2
3
4
5
6
7
8
#include <vector>

#include "Entity.h"
#include "Component.h"

void Entity::update() {
	componentPtrs[0]->update();
}

Eclipse error log (plain_text)

1
2
Description	Resource	Path	Location	Type
Method 'update' could not be resolved	Entity.cpp	/TestNewWS/src	line 7	Semantic Error