We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Firstly thanks for your help. My code looks similar to yours except the id and cur_id . I made the cur_id static and initalized it outside the class by zero and incremented it in the constructor. But unfortunately , it assigned the same cur_id to all the objects of the same type which is the highest one !
Can you explain why did you use another variable with the static one ?
Virtual Functions
You are viewing a single comment's thread. Return to all comments →
Firstly thanks for your help. My code looks similar to yours except the id and cur_id . I made the cur_id static and initalized it outside the class by zero and incremented it in the constructor. But unfortunately , it assigned the same cur_id to all the objects of the same type which is the highest one !
Can you explain why did you use another variable with the static one ?