P
pandy.song
In my project, there is a class "Father",
from which lots of "CHILD" class are inherited.
For the system is real-time embedded system,
"new" operation is applied here.
I want to pre-allocate a series of general
"CHILD" instances. Every time I want a specified
"CHILD" , I get one from a link list.
In C++, virtual class "FATHER" can not be
instanced.So the method I can bring to my mind
is to instance each "CHILD" class, and every
time I want a specified "CHILD", I get a memory
From a link list, and "memcpy" it.
This "memcpy" copy not only internal data ,but
virtual funtion table.
The method I memtion above may not be clever method.
I wander if there are better methods.
Thank you for your readimg this thread.
from which lots of "CHILD" class are inherited.
For the system is real-time embedded system,
"new" operation is applied here.
I want to pre-allocate a series of general
"CHILD" instances. Every time I want a specified
"CHILD" , I get one from a link list.
In C++, virtual class "FATHER" can not be
instanced.So the method I can bring to my mind
is to instance each "CHILD" class, and every
time I want a specified "CHILD", I get a memory
From a link list, and "memcpy" it.
This "memcpy" copy not only internal data ,but
virtual funtion table.
The method I memtion above may not be clever method.
I wander if there are better methods.
Thank you for your readimg this thread.