So after inserting your code i had to delete the '&' to make it work.
void operator = (const VEC v)
Sadly this also didnt fix anything, to the contrary even with commenting the delete now the programm freezes at the very first frame.
I tried to find out from where my destructer gets called, so i implemented Log's everywhere until i got the line.
Well, the destination was before even the main function gets called.
1 2 3 4 5 6 7
|
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
Log("WinMain");
...
|
This Log didnt get called at all, while this one
1 2 3 4 5
|
VEC::~VEC() {
Log("\nVEC Destructor:\n");
Log("data[0]", data[0]);
if(data) delete[] data;
}
|
gets called even twice, then it breaks.
What does it mean, i thought my program always starts at the main() or WinMain() function?
edit:
didnt read the other 2 comments while i was writing this as answer to the first one.
first i must say sorry, your code didnt cause the freeze, it was my "log" because my programm tries to open and close a .txt file about 100 time per ms. after deleting the logs it worked with your lines, but still only when commenting the delete line.
edit2 @Peter87:
Yeah google told me the same, sadly im not that much into c++ yet to udnerstand what i have to do. What is even an assignment operator? This is probably a dumb question, sorry.