Component Entity Design: dynamically adding and removing member variables.

I have been reading about component entity design and was wandering how to go about implementing it. I think I have an idea that might work but am confused about one thing. How do you add and remove components. Is it possible to create a new member variable from inside a member function? something like:
1
2
3
4
5
6
7
class thing
{
void addComponent1(component *toAdd)
{
component *Component1 = toAdd;
}
};


or would you have to have an array of components and just add and remove from that?
any tips on setting up a component entity design system would be greatly appreciated as I am looking for something new to tinker with.
Topic archived. No new replies allowed.