C++ dynamic classes
Hi,
I've tried using a dynamic class of arrays and I'm obviously not doing things right b/c after a while my program always segment faults
first of all i have a pointer class
myclass *cur;
myclass *array
cur=myfunc(); (my myfunc below)
<resize my class array with malloc/realloc>
array[last_item]=*cur;
myclass* myfunc()
{
myclass *con;
con = new myclass()
return con;
}
all this seems to work until after a while i get a seg fault so i am doing somethign wrong.
this is the line that causes the seg fault, but its not untill bout the 4-7 time.
array[last_item]=*cur;
should i be moving the class over wiht memcpy or something? or i am doing this whole thing totaly wrong?
Thanks
Tristan
|