Well, I don't really know how to explain this other than show you so that is what I'll do.
I know that doesn't make any sense, but what I am wanting to do is that when a is freed b is automatically set to NULL also.Code:int* a = new int(1000); int* b = a; delete a; a = 0;
I am also wanting to maintain the pointer syntax for the most part so I don't end up with another class that is unreadable. I also need to have it work on multiple levels. So basically
I want c and b to be set to null when a is freed.Code:int* a = new int(1000); int* b = a; int* c = b; //etc etc
I have been thinking about this for several hours, but I have yet to come up with anything that lets me maintain the regular syntax.
- I don't care about allowing directly newing or deleteing the data as a function for this is fine
- I want to maintain the * and -> to access the data for getting/setting
I am hoping someone here can give me some insight/ideas on how to achieve this. I am very grateful for any assistance. Thank you.



LinkBack URL
About LinkBacks



