I was "playing around" with pointers on the heap when a suddenly got an idea (probably a stupid one). Is it possible to allocate more dynamic memory on an already dynamic allocated memory? I will explain it with an example so you hopefully understand what I mean. For instanse if I use a (predefind or user-defined) string class through a pointer like this
This means that somewhere on the heap a string-object has been created (or allocated). Doesn´t this mean that all data-members are on the heap or free store??? Usually is a string class rather dynamic which means that it has some kind of pointer. That pointer allocates new dynamic memory on another place on the heap. Is it possible to to call new on a object thats on the heap as many times you wish???
string *pname = new string;
I just need some clarification.
//Pointer to a string, works good, string handles everthing "internally"
string *pek = new string;
//Pointer to a pointer-string, why doesn´t this work???
//*string *ppek = new *string;
I hope you understand what I mean.