, :
Entity.h:
#include <vector>
class Entity {
public:
std::vector<Component> children;
};
Component.h:
#include <Entity.h>
class Component : public Entity { ... };
- Component vector Component s:
Entity.h:
#ifndef ENTITY_H
#define ENTITY_H
#include <vector>
class Component;
class Entity {
public:
std::vector<Component*> children;
};
#endif
Component.h:
#ifndef COMPONENT_H
#define COMPONENT_H
#include <Entity.h> // To allow inheritance.
class Component : public Entity { ... };
#endif
Entity.cpp:
#include <Entity.h>
#include <Component.h> // To access Component members.