Setting a variable equal to the parent of a function?
Say I have a struct.
1 2 3 4 5
|
struct surface
{
...
void AddToQueue();
};
|
So I have a global array of this struct.
surface drawing_queue[1000];
Here is the function from the struct:
1 2 3 4
|
void surface::AddToQueue()
{
drawing_queue[4] = ???;
}
|
What would I put for "???" to set
drawing_queue[4]
equivalent to the parent surface (of the function that is called)?
In other words, if I call:
1 2
|
surface surface_to_add;
surface_to_add.AddToQueue();
|
What would I do to the function that would make it so that
drawing_queue[4]
is pointing to
surface_to_add
?
Last edited on
It looks like you want an array of pointers.
surface* drawing_queue[1000];
I think this is what you want.
1 2 3 4
|
void surface::AddToQueue()
{
drawing_queue[4] = this;
}
|
Yeah. That would be better.
Thanks! I just haven't done this kind of thing before.
Last edited on
Topic archived. No new replies allowed.