I am begginer at programing and I run into small problem that I cannot overdo with any turtorial.
As stated in the topic I made static variable in class called "record" in which I store records about some random things. Each of them has ID number, which should be unique for every object created fom that class.
Ok, till now it works fine.
Using 'new' command I created table of those records, but sometimes it's fills up. When it happens I just create another, copy all records from first one to second, temporary one, then 'delete []' first one, and make new, bigger one.
Well, this should be standard thing to do, and it works fine.
My constructor has definition like this:
When creating new tables with 'new' it automaticaly makes number_of_records grow alot, so before all described before actions I just write
unsigned int temp=rekord::number_of_records;
and after everything I do:
rekord::number_of_records=temp;
I though it would fix little bug that I get. When table of records "grows" newest ID is OK, fe. if last was 114 next one is 115, but NEXT one is higher by random number. Then it works just fine till next "grow".
I hope that someone can help me with that little info. I can post even whole source here, but it is really _bad_ so I wouldn't like to
As stated in the topic I made static variable in class called "record" in which I store records about some random things. Each of them has ID number, which should be unique for every object created fom that class.
Ok, till now it works fine.
Using 'new' command I created table of those records, but sometimes it's fills up. When it happens I just create another, copy all records from first one to second, temporary one, then 'delete []' first one, and make new, bigger one.
Well, this should be standard thing to do, and it works fine.
My constructor has definition like this:
| Code: |
| rekord::rekord()
{ number_of_records++; ID=number_of_records; } |
When creating new tables with 'new' it automaticaly makes number_of_records grow alot, so before all described before actions I just write
unsigned int temp=rekord::number_of_records;
and after everything I do:
rekord::number_of_records=temp;
I though it would fix little bug that I get. When table of records "grows" newest ID is OK, fe. if last was 114 next one is 115, but NEXT one is higher by random number. Then it works just fine till next "grow".
I hope that someone can help me with that little info. I can post even whole source here, but it is really _bad_ so I wouldn't like to
